Beispiel #1
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var tamung = new Entity.MSSQL_QLDN_QLNS.Entity.TamUng();
                foreach (var nhanvienid in NhanVienIds.Split('|'))
                {
                    tamung.NhanVienId  = Protector.Int(nhanvienid);
                    tamung.So          = So;
                    tamung.Ngay        = DateTime.ParseExact(Ngay, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                    tamung.Tien        = Protector.Int(Tien);
                    tamung.BangChu     = BangChu;
                    tamung.LyDo        = LyDo;
                    tamung.NguoiTao    = Protector.Int(NguoiTao);
                    tamung.NgayTao     = DateTime.Now;
                    tamung.MaTrangThai = "TU_DD";
                    tamung.XoaYN       = "N";
                    tamung.CtrVersion  = 1;

                    TamUngRepository repo = new TamUngRepository(context);
                    await repo.Insert(tamung);

                    InsertLuocSuAction ls = new InsertLuocSuAction();
                    ls.InsertLuocSu(context, "TamUng", tamung.TamUngId, "Insert", tamung.NguoiTao);
                }
                return(returnActionResult(HttpStatusCode.OK, tamung, 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));
            }
        }