public ActionResult Edit(Company company) { var companyEntity = _fR.GetWhere <Company>(s => s.Id == company.Id && s.Status && !s.IsDeleted)?.FirstOrDefault() ?? new Company(); if (company.Id <= 0) { return(RedirectToAction("Index")); } // companyEntity.Name = company.Name?.Trim(); companyEntity.Country = company.Country?.Trim(); companyEntity.CountryCode = company.CountryCode?.Trim(); companyEntity.Region = company.Region?.Trim(); companyEntity.TaxNumber = company.TaxNumber?.Trim(); companyEntity.ZipCode = company.ZipCode?.Trim(); companyEntity.City = company.City?.Trim(); companyEntity.Address = company.Address?.Trim(); companyEntity.CustomerCode = company.CustomerCode?.Trim(); companyEntity.UpdatedDate = DateTime.Now; // _fR.Update(companyEntity); _fR.SaveChanges(); // return(RedirectToAction("Index")); }
public ActionResult Edit(Supplier supplier) { var supplierEntity = _fR.GetWhere <Supplier>(s => s.Id == supplier.Id && s.Status && !s.IsDeleted)?.FirstOrDefault() ?? new Supplier(); if (supplier.Id <= 0) { return(RedirectToAction("Index")); } // supplierEntity.Name = supplier.Name?.Trim(); supplierEntity.Code = supplier.Code?.Trim(); supplierEntity.UpdatedDate = DateTime.Now; // _fR.Update(supplierEntity); _fR.SaveChanges(); // return(RedirectToAction("Index")); }
public ActionResult Edit(Product product) { var productEntity = _fR.GetWhere <Product>(s => s.Id == product.Id && s.Status && !s.IsDeleted)?.FirstOrDefault() ?? new Product(); if (product.Id <= 0) { return(RedirectToAction("Index")); } // productEntity.Name = product.Name?.Trim(); productEntity.Code = product.Code?.Trim(); productEntity.Barcode = product.Barcode?.Trim(); productEntity.DefaultCount = product.DefaultCount; productEntity.Price = product.Price; productEntity.UpdatedDate = DateTime.Now; // _fR.Update(productEntity); _fR.SaveChanges(); // return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { var orderEntity = _fR.GetWhere <Order>(s => s.Id == id && s.Status && !s.IsDeleted)?.FirstOrDefault() ?? new Order(); orderEntity.Status = false; orderEntity.IsDeleted = true; orderEntity.DeletedDate = DateTime.Now; // _fR.Update(orderEntity); _fR.SaveChanges(); return(Json(new Response { Status = true, EntityId = id, Message = "Silindi", TotalCount = 1 })); }
public ActionResult Edit(Discount discount) { var discountEntity = _fR.GetWhere <Discount>(s => s.Id == discount.Id)?.FirstOrDefault() ?? new Discount(); if (discount.Id <= 0) { return(RedirectToAction("Index")); } // discountEntity.Name = discount.Name?.Trim(); discountEntity.FirstPercent = discount.FirstPercent; discountEntity.SecondPercent = discount.SecondPercent; discountEntity.ThirdPercent = discount.ThirdPercent; discountEntity.FourthPercent = discount.FourthPercent; // _fR.Update(discountEntity); _fR.SaveChanges(); // return(RedirectToAction("Index")); }