Пример #1
0
        public async System.Threading.Tasks.Task <ActionResult> Edit(QuaTrinhLamViecEditViewModel model)
        {
            try
            {
                var quaTrinhLamViecService = this.Service <IQuaTrinhLamViecService>();
                var modifiedEntity         = await quaTrinhLamViecService.GetAsync(model.Id);

                if (!model.DangLam.HasValue)
                {
                    model.DangLam = false;
                }
                model.CopyToEntity(modifiedEntity);
                modifiedEntity.Active           = true;
                modifiedEntity.IdThongTinCaNhan = model.IdThongTinCaNhan;

                await quaTrinhLamViecService.UpdateAsync(modifiedEntity);

                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                var    result         = await new SystemLogController().Create("Sửa", controllerName, modifiedEntity.Id);

                return(Json(new { success = true, message = "Sửa thành công!" }));
            }
            catch
            {
                return(Json(new { success = false, message = "Có lỗi xảy ra, xin liên hệ admin!!!" }));
            }
        }
Пример #2
0
        public ActionResult Create(int idThongTinCaNhan)
        {
            var quaTrinhLamViecService = this.Service <IQuaTrinhLamViecService>();
            var model = new QuaTrinhLamViecEditViewModel()
            {
                IdThongTinCaNhan = idThongTinCaNhan,
                DangLam          = false,
            };

            return(View(model));
        }
Пример #3
0
        public async System.Threading.Tasks.Task <ActionResult> Edit(int id)
        {
            var quaTrinhLamViecService = this.Service <IQuaTrinhLamViecService>();
            var model = new QuaTrinhLamViecEditViewModel(await quaTrinhLamViecService.GetAsync(id));

            if (model == null || model.Active == false)
            {
                return(Json(new { success = false, }));
            }
            return(View(model));
        }
Пример #4
0
        public async System.Threading.Tasks.Task <ActionResult> Create(QuaTrinhLamViecEditViewModel model)
        {
            try
            {
                var quaTrinhLamViecService = this.Service <IQuaTrinhLamViecService>();
                model.Active = true;
                var entity = model.ToEntity();

                await quaTrinhLamViecService.CreateAsync(model.ToEntity());

                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
            {
                return(Json(new { success = false, message = "Có lỗi xảy ra, xin liên hệ admin!!!" }));
            }
        }