예제 #1
0
        public async System.Threading.Tasks.Task <ActionResult> Edit(int id)
        {
            var thongTinNopTienService = this.Service <IThongTinNopTienService>();
            var model = new ThongTinNopTienEditViewModel(await thongTinNopTienService.GetAsync(id));

            if (model == null || model.Active == false)
            {
                return(Json(new { success = false, message = Resource.ErrorMessage }));
            }
            model.ThuChi      = (ThuChi)model.ThuHayChi;
            model.TypeOfMoney = (TypeOfMoney)model.LoaiTien;
            return(View(model));
        }
예제 #2
0
        public ActionResult Create()
        {
            var thongTinCaNhanService = this.Service <IThongTinCaNhanService>();
            var model = new ThongTinNopTienEditViewModel();

            model.ThuChi                  = (ThuChi)model.ThuHayChi;
            model.TypeOfMoney             = (TypeOfMoney)model.LoaiTien;
            model.AvailableThongTinCaNhan = thongTinCaNhanService.GetActive().Select(q => new SelectListItem()
            {
                Text     = q.HoTen,
                Value    = q.Id.ToString(),
                Selected = false,
            });
            return(View(model));
        }
예제 #3
0
        public async System.Threading.Tasks.Task <ActionResult> Create(ThongTinNopTienEditViewModel model)
        {
            try
            {
                var thongTinCaNhanService  = this.Service <IThongTinCaNhanService>();
                var thongTinNopTienService = this.Service <IThongTinNopTienService>();
                model.Active    = true;
                model.ThuHayChi = (int)model.ThuChi;
                var entity = model.ToEntity();
                await thongTinNopTienService.CreateAsync(entity);

                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                var    result         = await new SystemLogController().Create("Tạo", controllerName, entity.Id);
                return(Json(new { success = true, message = "Tạo thành công" }));
            }
            catch (Exception e)
            {
                return(Json(new { success = false, message = Resource.ErrorMessage }));
            }
        }
예제 #4
0
        public async System.Threading.Tasks.Task <ActionResult> Edit(ThongTinNopTienEditViewModel model)
        {
            try
            {
                var thongTinNopTienService = this.Service <IThongTinNopTienService>();
                var entity = await thongTinNopTienService.GetAsync(model.Id);

                entity.LoaiTien     = model.LoaiTien;
                entity.SoTien       = model.SoTien;
                entity.NgayLapPhieu = model.NgayLapPhieu;
                entity.LyDo         = model.LyDo;
                entity.ThuHayChi    = (int)model.ThuChi;

                await thongTinNopTienService.UpdateAsync(entity);

                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                var    result         = await new SystemLogController().Create("Sửa", controllerName, entity.Id);
                return(Json(new { success = true, message = "Sửa thành công!" }));
            }
            catch (Exception e)
            {
                return(Json(new { success = false, message = Resource.ErrorMessage }));
            }
        }