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

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

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

                msg.Error = false;
                msg.Title = "Đã lưu thay đổi";

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