Ejemplo n.º 1
0
        public void Update(SupplierCountryBank ObjUpdate)
        {
            var ObjToUpdate = _context.SupplierCountryBanks.FirstOrDefault(m => m.CompanyID == ObjUpdate.CompanyID && m.SupplierCountryBankID == ObjUpdate.SupplierCountryBankID);

            if (ObjToUpdate != null)
            {
                ObjToUpdate.ArabicName  = ObjUpdate.ArabicName;
                ObjToUpdate.EnglishName = ObjUpdate.EnglishName;
                ObjToUpdate.InsDateTime = ObjUpdate.InsDateTime;
                ObjToUpdate.InsUserID   = ObjUpdate.InsUserID;
            }
        }
Ejemplo n.º 2
0
        public JsonResult UpdateSupplierCountryBank(SupplierCountryBank ObjUpdate)
        {
            MsgUnit Msg = new MsgUnit();

            try
            {
                var userId   = User.Identity.GetUserId();
                var UserInfo = _unitOfWork.User.GetMyInfo(userId);

                ObjUpdate.CompanyID   = UserInfo.fCompanyId;
                ObjUpdate.InsDateTime = DateTime.Now;
                ObjUpdate.InsUserID   = userId;
                if (String.IsNullOrEmpty(ObjUpdate.EnglishName))
                {
                    ObjUpdate.EnglishName = ObjUpdate.ArabicName;
                }

                if (!ModelState.IsValid)
                {
                    string Err    = " ";
                    var    errors = ModelState.Values.SelectMany(v => v.Errors);
                    foreach (ModelError error in errors)
                    {
                        Err = Err + error.ErrorMessage + " * ";
                    }

                    Msg.Msg  = Resources.Resource.SomthingWentWrong + " : " + Err;
                    Msg.Code = 0;
                    return(Json(Msg, JsonRequestBehavior.AllowGet));
                }
                _unitOfWork.SupplierCountryBank.Update(ObjUpdate);
                _unitOfWork.Complete();

                Msg.Code = 1;
                Msg.Msg  = Resources.Resource.UpdatedSuccessfully;
                return(Json(Msg, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Msg.Msg  = Resources.Resource.SomthingWentWrong + " : " + ex.Message.ToString();
                Msg.Code = 0;
                return(Json(Msg, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 3
0
 public void Add(SupplierCountryBank ObjSave)
 {
     _context.SupplierCountryBanks.Add(ObjSave);
 }