public JsonResult Insert([FromBody] UrencoMaterialProductGroup obj)
        {
            var msg = new JMessage {
                Title = "", Error = false
            };

            try
            {
                var exist = _context.UrencoMaterialProductGroup.FirstOrDefault(x => x.Code == obj.Code);
                if (exist != null)
                {
                    msg.Error = true;
                    msg.Title = String.Format(CommonUtil.ResourceValue("MPG_MSG_MPG_CODE_ALREADY_EXIST"));//"Mã nhóm vật tư đã tồn tại";
                }
                else
                {
                    obj.CreatedBy   = ESEIM.AppContext.UserName;
                    obj.CreatedTime = DateTime.Now;
                    _context.UrencoMaterialProductGroup.Add(obj);
                    _context.SaveChanges();
                    msg.Title = String.Format(CommonUtil.ResourceValue("COM_MSG_ADD_SUCCESS"), CommonUtil.ResourceValue("MGP_LBL_MGP"));//"Thêm nhóm vật tư thành công";
                }
            }
            catch
            {
                msg.Error = true;
                msg.Title = String.Format(CommonUtil.ResourceValue("MGP_MSG_ADD_ERROR"));  //"Thêm nhóm vật tư lỗi";
            }
            return(Json(msg));
        }
        public object Update([FromBody] UrencoMaterialProductGroup obj)
        {
            var msg = new JMessage();

            try
            {
                obj.UpdatedTime = DateTime.Now.Date;
                _context.UrencoMaterialProductGroup.Update(obj);
                _context.SaveChanges();

                msg.Error = false;
                msg.Title = String.Format(CommonUtil.ResourceValue("MGP_MSG_SAVE_SUCCESS")); //"Đã lưu thay đổi";

                return(msg);
            }
            catch
            {
                msg.Error = true;
                msg.Title = String.Format(CommonUtil.ResourceValue("MGP_MSG_ERROR")); //"Có lỗi xảy ra!";
                return(msg);
            }
        }