public void Insert(FormCollection fc) { if (fc["NamePrice"].ToString() != "") { Price _pro = new Price() { IsDeleted = false, PriceValue = fc["NamePrice"].ToString() }; _PriceService.InsertPrice(_pro); _unitOfWork.SaveChanges(); } Response.Redirect("Index"); }
public void update() { Price price = new Price(); if (Request.Params["IdUpdate"].Length > 0) { int id = int.Parse(Request.Params["IdUpdate"]); price = _PriceService.GetPriceById(id); if (Request.Params["NamePrice"].Length > 0) { price.PriceValue = Request.Params["NamePrice"]; _PriceService.UpdatePrice(price); _unitOfWork.SaveChanges(); } } Response.Redirect("Index"); }