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

            return(isSaved);
        }
コード例 #2
0
ファイル: BranchesController.cs プロジェクト: ayaovi/cl1n1c
 public ActionResult Edit([Bind(Include = "BranchCode,BranchName,BranchLocation")] Branch branch)
 {
     if (ModelState.IsValid)
     {
         _db.Edit(branch);
         return(RedirectToAction("Index"));
     }
     return(View(branch));
 }
コード例 #3
0
ファイル: BlBranch.cs プロジェクト: sabounjirony/DeirElAhmar
        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);
            }
        }
コード例 #4
0
 public ActionResult Edit(Branch branch)
 {
     try
     {
         _branchRepository.Edit(branch);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #5
0
ファイル: BranchController.cs プロジェクト: juancho618/Cargo
        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));
        }