Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
669 B
4
Indexable
Never
public async Task<TaskList> PostTask(string taskname, string taskDesc, DateTime start, DateTime end)
{
    {
        try
        {
            _context.Database.EnsureCreated();
            TaskList AddingTask = new TaskList()
            {
                TaskTitle = taskname,
                TaskDescription = taskDesc,
                StartDate = start,
                EndDate = end,
                TaskStatusCode = 4
            };
            _context.Add(AddingTask);
            await _context.SaveChangesAsync();
            return AddingTask;
        }
        catch (Exception ex)
        {
            return null;
        }
    }
}
Leave a Comment