Beispiel #1
0
        public bool Update(Branch branch)
        {
            int  rowAffected = branchRepository.Edit(branch);
            bool isSaved     = rowAffected > 0;

            return(isSaved);
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "BranchCode,BranchName,BranchLocation")] Branch branch)
 {
     if (ModelState.IsValid)
     {
         _db.Edit(branch);
         return(RedirectToAction("Index"));
     }
     return(View(branch));
 }
Beispiel #3
0
        public Branch Edit(long userId, Branch toEdit)
        {
            using (var tran = new TransactionScope())
            {
                var toRet = _repository.Edit(toEdit);

                BlLog.Log(userId, Module, "Delete branch", "BranchModified", new object[] { toEdit.Id });
                tran.Complete();
                return(toRet);
            }
        }
 public ActionResult Edit(Branch branch)
 {
     try
     {
         _branchRepository.Edit(branch);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #5
0
        public ActionResult Edit([Bind(Include = "Id, Name")] BranchViewModel branch)
        {
            var response = new JsonResultBody();

            try
            {
                response.Data = _repository.Edit(Mapper.Map <BranchViewModel, Branch>(branch));
            }
            catch (DbEntityValidationException ex)
            {
                response.Status = System.Net.HttpStatusCode.InternalServerError;
                foreach (DbEntityValidationResult result in ex.EntityValidationErrors)
                {
                    response.Errors = (from ve in result.ValidationErrors select ve.ErrorMessage).ToList();
                }
            }
            catch (Exception exApp)
            {
                response.Status = System.Net.HttpStatusCode.InternalServerError;
                response.Errors.Add(exApp.Message);
            }

            return(Json(response));
        }