public IActionResponse <int> Update(OfficeAddress model)
        {
            var addr = _officeAddress.Find(model.OfficeAddressId);

            if (addr == null)
            {
                return new ActionResponse <int> {
                           Message = BusinessMessage.RecordNotFound
                }
            }
            ;
            addr.UpdateWith(new
            {
                model.DeliveryName,
                model.FullAddress,
                model.IsActive,
                model.LangType,
                model.Location,
                model.MobileNumber,
                model.Tel,
                model.WorkHour,
                model.UserId
            });
            _uow.Entry(addr).State = EntityState.Modified;
            var res = _uow.SaveChanges();

            return(new ActionResponse <int>
            {
                IsSuccessful = res.ToSaveChangeResult(),
                Message = res.ToSaveChangeMessageResult(BusinessMessage.Success, BusinessMessage.Error),
                Result = model.OfficeAddressId
            });
        }
 public virtual JsonResult Edit(OfficeAddress model)
 {
     if (!ModelState.IsValid)
     {
         return(Json(new { IsSuccessful = false, Message = LocalMessage.ValidationFailed }));
     }
     return(Json(_officeAddressBusiness.Update(model)));
 }
        public IActionResponse <int> Insert(OfficeAddress model)
        {
            _officeAddress.Add(model);
            var dbRes = _uow.SaveChanges();

            return(new ActionResponse <int>()
            {
                IsSuccessful = dbRes.ToSaveChangeResult(),
                Result = model.OfficeAddressId
            });
        }
        public virtual JsonResult Add(OfficeAddress model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new { IsSuccessful = false, Message = LocalMessage.ValidationFailed }));
            }
            var rep = _officeAddressBusiness.Insert(model);

            if (!rep.IsSuccessful)
            {
                return(Json(rep));
            }
            return(Json(new
            {
                IsSuccessful = true,
                Result = MvcExtention.RenderViewToString(this, MVC.OfficeAddress.Views.Partial._ListAddress, _officeAddressBusiness.GetAll())
            }));
        }
 public RegisteredOfficeAddressResourceBuilder(OfficeAddress officeAddress)
 {
     _officeAddress = officeAddress;
 }