private void btnUpdate_Click(object sender, EventArgs e) { //if(txtSearch.Text==string.Empty) //{ // MessageBox.Show("Please Select An Category ID "); // return; //} if (MessageBox.Show("Are You Sure To Update Category?", "UpdateAlert", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { CategoryBL ojcate = new CategoryBL() { CategoryID = Convert.ToInt32(txtCategoryID.Text) }; ojcate.Update(); MessageBox.Show("Record Updated"); ClearGroup(); LoadData(); } else { MessageBox.Show("Record Not Update"); } }
public ActionResult Edit(CategoryModel Model) { if (ModelState.IsValid) { List <string> lstMsg = new List <string>(); int returnCode = _categoryBL.Update(Model, out lstMsg); if (!((int)Common.ReturnCode.Succeed == returnCode)) { if (lstMsg != null) { for (int i = 0; i < lstMsg.Count(); i++) { ModelState.AddModelError(string.Empty, lstMsg[i]); } } ViewBag.Parent = new SelectList(_categoryBL.GetListParent(), "id", "name"); return(View(Model)); } TempData["Success"] = "Updated Successfully!"; return(RedirectToAction("View", new { @id = Model.id })); } ViewBag.Parent = new SelectList(_categoryBL.GetListParent(), "id", "name"); return(View(Model)); }
// PUT: api/Categorias/5 public HttpResponseMessage Put(string id, Category category) { if (id != category.CategoryID) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } else { categoryBL.Update(category); return(Request.CreateResponse(HttpStatusCode.OK)); } }
public ActionResult Edit(CategoryViewModel categoryViewModel) { if (category != null) { var config = new MapperConfiguration(mapping => { mapping.CreateMap <CategoryViewModel, Category>(); }); IMapper mapper = config.CreateMapper(); Category category = mapper.Map <CategoryViewModel, Category>(categoryViewModel); categoryBL.Update(category); return(RedirectToAction("CategoryDetails")); } return(View()); }
public void Edit() { var category = categoryBL.Update(cacheKey, new CategoryDO() { Id = 10, CategoryName = "mocking", ParentCategoryId = 0, CategoryCode = "mocking", CreateUserId = "mocking", CreateTime = DateTime.Now, UpdateUserId = "mocking", UpdateTime = DateTime.Now, Description = "mocking", IsActive = true, DisplayOrder = 10 }); }
/// <summary> /// This method provides the cagetory editing. I take the original object from the DB, and change the propertys based on the given paramters. /// After that I update the DB with the new object, and I redirecting to the Index action. /// </summary> /// <param name="category"></param> /// <param name="originalName"></param> /// <returns></returns> public ActionResult EditCategory(CATEGORIES category, string originalName) { try { CATEGORIES originalCategory = objBS.GetByID(originalName); originalCategory.Price = category.Price; originalCategory.ProcessLengthInMunites = category.ProcessLengthInMunites; objBS.Update(originalCategory); return(RedirectToAction("Index", new { afterCreateCageory = "A kiválaszott kategória sikeresen szerkesztve!" })); } catch { TempData["Msg"] = "A kategória szerkesztése sikertelen"; return(RedirectToAction("Edit", new { id = originalName })); } }
public void update([FromBody] CategoryDTO category) { CategoryBL.Update(category); }