Ejemplo n.º 1
0
 public async System.Threading.Tasks.Task <OperationResult <Task> > CreateTask(Task task)
 {
     return(await System.Threading.Tasks.Task.Factory.StartNew <OperationResult <Task> >(() =>
     {
         OperationResult <Task> result = new OperationResult <Task>();
         try
         {
             if (IsInCompany())
             {
                 task.CompanyId = CurrentUser.CompanyId.Value;
                 if (task.StaffId == Guid.Empty)
                 {
                     task.StaffId = CurrentUser.Id;
                 }
                 Task newTask = TasksRepository.CreateOrUpdate(task);
                 if (newTask.Id > 0)
                 {
                     result.SingleResult = newTask;
                     result.Result = true;
                 }
             }
         }
         catch (Exception ex)
         {
             LoggingService.Log(ex);
         }
         return result;
     }));
 }