示例#1
0
        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;
        }
示例#2
0
 public SupportTicketNewModel(SupportTicket ticket)
 {
 }
示例#3
0
 public SupportTicketEditModel()
 {
     Ticket = new SupportTicket();
 }
示例#4
0
 public SupportTicketEditModel(SupportTicket ticket)
 {
     Ticket = ticket;
 }
示例#5
0
        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);
            }
        }