示例#1
0
 public ErrorSolutionDTO Add(int errorId, ErrorSolutionDTO sln)
 {
     using (UoW)
     {
         var error = UoW.Errors.Get(errorId);
         if (error == null)
         {
             throw new ApplicationOperationException(string.Format("Error with id {0} not found", errorId), HttpStatusCode.NotFound);
         }
         if (error.Solution != null)
         {
             Delete(error.Solution.Id);
         }
         error.Status = sln.ErrorStatus;
         var solution = new ErrorSolution()
         {
             Error         = error,
             Description   = sln.Description,
             RecievingDate = DateTime.UtcNow,
             Author        = CurrentUser
         };
         UoW.Solutions.Add(solution);
         UoW.Complete();
         return(Mapper.Map <ErrorSolutionDTO>(solution));
     }
 }
示例#2
0
 public ErrorSolutionDTO Update(int id, ErrorSolutionDTO sln)
 {
     using (UoW)
     {
         var solution = UoW.Solutions.Get(id);
         if (solution == null)
         {
             throw new ApplicationOperationException(string.Format("Solution with id {0} not found", id), HttpStatusCode.NotFound);
         }
         solution.Error.Status  = sln.ErrorStatus;
         solution.Description   = sln.Description;
         solution.RecievingDate = DateTime.UtcNow;
         solution.Author        = CurrentUser;
         UoW.Complete();
         return(Mapper.Map <ErrorSolutionDTO>(solution));
     }
 }
 public void AddSolution(ErrorSolutionDTO _solution)
 {
     //using (UoW)
     //{
     //    var error = UoW.Errors.Get(_solution.ErrorId);
     //    if (error == null)
     //    {
     //        throw new ApplicationOperationException(string.Format("Error with id {0} not found", _solution.ErrorId), HttpStatusCode.NotFound);
     //    }
     //    var solution = new ErrorSolution();
     //    solution.Author = CurrentUser;
     //    solution.Error = error;
     //    solution.Description = _solution.Description;
     //    solution.DateSolution = _solution.DateSolution;
     //    UoW.Solutions.Add(solution);
     //    UoW.Complete();
     //}
 }
 public ErrorSolutionDTO Update([Required] int id, ErrorSolutionDTO sln)
 {
     return(_solutionService.Update(id, sln));
 }
 public ErrorSolutionDTO Add([Required] int errorId, ErrorSolutionDTO sln)
 {
     return(_solutionService.Add(errorId, sln));
 }
示例#6
0
 public ErrorSolutionDTO AddSolution([Required] ErrorSolutionDTO solution)
 {
     _errorService.AddSolution(solution);
     return(solution);
 }