public static C.SupportTicket ToContract(this SupportTicket data) { if (data == null) return null; var model = new C.SupportTicket() { TicketId = data.TicketId, FirstName = data.FirstName, LastName = data.LastName, CreatedByUserID = data.CreatedUserID, CreatedDate = data.CreatedDate, IssueText = data.IssueText, SupportCategory = (SupportCategoryEnum)Enum.Parse(typeof(SupportCategoryEnum), data.IssueCategory), ResolvedText = data.ResolvedText, ResolvedDate = data.ResolvedDate, ResolvedByUserID = data.ResolvedUserID, EmailAddress = data.EmailAddress, ContactPhone = data.ContactPhone }; if (data.ResolvedUserID.HasValue) model.ResolvedBy = String.Format("{0} {1}", data.ResolvedUser.FirstName, data.ResolvedUser.LastName); return model; }
public SupportTicketNewModel(SupportTicket ticket) { }
public SupportTicketEditModel() { Ticket = new SupportTicket(); }
public SupportTicketEditModel(SupportTicket ticket) { Ticket = ticket; }
public ActionResult NewSupportTicket(SupportTicketNewModel model) { var newTick = new SupportTicket() { FirstName = model.FirstName, LastName = model.LastName, EmailAddress = model.EmailAddress, ContactPhone = model.ContactPhone, IssueText = model.IssueText, SupportCategory = (SupportCategoryEnum)Enum.Parse(typeof(SupportCategoryEnum), model.SelectedCategory), }; var resp = _tickManager.SaveSupportTicket(new SaveSupportTicketRequest() { Ticket = newTick }); if (resp.Status == Status.Success) { var uiresponse = resp.ToUIResult<SupportTicketNewModel>(() => new SupportTicketNewModel(resp.Ticket), (vm) => string.Empty); return Json(uiresponse); } else { var uiresponse = new Result<SupportTicketNewModel>(Status.Error); uiresponse.Messages.AddRange(resp.Messages); return Json(uiresponse); } }