public CloseTicketResponse Close(CloseTicketRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } using (var trans = transactionFactory.GetTransaction()) { var ticket = repo.Get(request.Identity); if (ReferenceEquals(ticket, null)) { return new CloseTicketResponse { TicketNotFound = true } } ; if (ticket.Closed) { return new CloseTicketResponse { TicketAlreadyClosed = true } } ; ticket.Closed = true; repo.Update(ticket); trans.Commit(); } return(new CloseTicketResponse()); }
public EditTicketResponse Edit(EditTicketRequest request) { logger.Debug("About to validate an edit-ticket request"); var validationResult = ValidateRequest(request); logger.Debug(validationResult); if (!validationResult.IsSuccess) { return(responseCreator.GetResponse(validationResult, null)); } using (var trans = transactionFactory.GetTransaction()) { if (logger.IsDebugEnabled) { logger.Debug($"Transaction used is a {trans.GetType().FullName}"); } var ticket = ticketRepo.Get(request.Identity); editor.Edit(ticket, request); ticketRepo.Update(ticket); trans.Commit(); return(responseCreator.GetResponse(validationResult, ticket)); } }
public CreateCommentResponse Create(CreateCommentRequest request) { var validator = validatorFactory.GetValidator(); var validationResult = validator.Validate(request); if (!validationResult.IsSuccess) { return(responseCreator(validationResult, null)); } Comment comment; using (var tran = transactionCreator.GetTransaction()) { var ticket = ticketRepo.Get(request.TicketId); comment = commentFactory.Create(request.Body); ticket.Comments.Add(comment); ticketRepo.Update(ticket); commentRepo.Add(comment); tran.Commit(); } return(responseCreator(validationResult, comment)); }
public ActionResult Edit(Firm firm) { try { if (ModelState.IsValid) { firmData.Update(firm); firmData.Commit(); return(RedirectToAction(nameof(Index))); } else { return(View(firm)); } } catch { return(View()); } }
public EditSprintResponse Edit(EditSprintRequest request) { var validationResult = ValidateRequest(request); if (!validationResult.IsSuccess) { return(responseCreator(validationResult, null)); } Sprint sprint; using (var trans = transactionFactory.GetTransaction()) { sprint = sprintRepo.Get(request.SprintIdentity); mapper.Map(request, sprint); sprintRepo.Update(sprint); trans.Commit(); } return(responseCreator(validationResult, sprint)); }
public EditCommentResponse Edit(EditCommentRequest request) { var validator = validatorFactory.GetValidator(); var validationResult = validator.Validate(request); if (!validationResult.IsSuccess) { return(responseCreator(validationResult)); } using (var tran = transactionCreator.GetTransaction()) { var comment = commentRepo.Get(request.CommentIdentity); comment.Body = request.Body; comment.LastEditTimestamp = environment.GetCurrentUtcTimestamp(); commentRepo.Update(comment); tran.Commit(); } return(responseCreator(validationResult)); }
public ActionResult Edit(QuestionAnswer questionAnswer) { try { if (ModelState.IsValid) { questionAnswerData.Update(questionAnswer); questionAnswerData.Commit(); return(RedirectToAction(nameof(Index))); } else { return(View(questionAnswer)); } } catch { return(View()); } }
protected virtual void Save(User user) { repo.Update(user); }