示例#1
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var issuae = new Entity.MSSQL_QLDN_QLNS.Entity.Issue();
                issuae.KhachHangId = Protector.Int(KhachHangId);
                if (NgayTao != null)
                {
                    issuae.NgayTao = DateTime.ParseExact(NgayTao, "dd/MM/yyyy HH:mm", CultureInfo.GetCultureInfo("fr-FR"));
                }
                issuae.NguoiLienHe = NguoiLienHe;
                issuae.DienThoai   = DienThoai;
                issuae.DiDong      = DiDong;
                issuae.Email       = Email;
                issuae.TieuDe      = TieuDe;
                issuae.MoTa        = MoTa;
                issuae.LoaiIssue   = Protector.Short(LoaiIssue);
                if (NgayDeNghi != null)
                {
                    issuae.NgayDeNghi = DateTime.ParseExact(NgayDeNghi, "dd/MM/yyyy HH:mm", CultureInfo.GetCultureInfo("fr-FR"));
                }
                issuae.NguoiXuLy   = Protector.Int(NguoiXuLy);
                issuae.CachXuLy    = CachXuLy;
                issuae.HuongXuLy   = HuongXuly;
                issuae.MaTrangThai = MaTrangThai;
                if (MaTrangThai == "3")
                {
                    issuae.NgayKetThuc = DateTime.Now;
                }
                issuae.NgayTao    = DateTime.Now;
                issuae.NguoiTao   = Protector.Int(NguoiTao);
                issuae.XoaYn      = "N";
                issuae.CtrVersion = 1;

                IssueRepository repo = new IssueRepository(context);
                await repo.Insert(issuae);

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "Issue", issuae.IssueId, "Insert", issuae.NguoiTao);
                return(returnActionResult(HttpStatusCode.OK, issuae, null));
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }