public ActionResult EditCategory(BookStoreAdmin.ViewModels.Category category) { BookStoreAdmin.ViewModels.Response <BookStoreAdmin.ViewModels.Category> response = new ViewModels.Response <BookStoreAdmin.ViewModels.Category>(); category = BookStoreAdmin.BAL.Category.EditCategory(category); response.success = true; response.data = category; response.errorMessage = null; return(Json(response, JsonRequestBehavior.AllowGet)); }
public static BookStoreAdmin.ViewModels.Category EditCategory(BookStoreAdmin.ViewModels.Category category) { BookStoreAdmin.Models.category objCategory = new Models.category(); using (BookStoreAdmin.Models.BookStoreAdminEntities1 context = new BookStoreAdminEntities1()) { objCategory = context.categories.Find(category.id); objCategory.name = category.name; objCategory.description = category.description; context.SaveChanges(); } return(category); }