// GET: services/stores public IHttpActionResult Get() { dynamic Response = new System.Dynamic.ExpandoObject(); var json = string.Empty; try { IList <Store> stores = new StoresBL().getStores(); if (stores.Count > 0) { Response.success = true; Response.store = new List <Store>(); Response.stores = stores; Response.total_elements = stores.Count; } else { Response.success = false; Response.error_code = HttpStatusCode.NotFound; Response.error_msg = "Records not Found"; } json = new JavaScriptSerializer().Serialize(Response); return(Ok(json)); } catch (System.Exception ex) { Response.success = false; Response.error_code = HttpStatusCode.InternalServerError; Response.error_msg = ex.Message.ToString(); json = new JavaScriptSerializer().Serialize(Response); return(Ok(json)); } }
public ActionResult Index() { StoresBL StoreBL = new StoresBL(); var Stores = StoreBL.GetStores(); return(View(Stores)); }
//[HasPermission("DELETE_Stores")] //public ActionResult Delete(int id) //{ // StoresBL storeBL = new StoresBL(); // ReturnResult result = storeBL.DeleteStore(id); // //if (!result.IsSuccess) // //{ // // TempData["Message"] = "Error while deleting category."; // //} // // return RedirectToAction("Index"); // return View(); //} public ActionResult Delete(int id) { StoresBL storeBL = new StoresBL(); ReturnResult result = storeBL.DeleteStore(id); if (!result.IsSuccess) { TempData["Message"] = "Error while deleting category."; } return(RedirectToAction("Index")); // return View(); }
private ActionResult SaveStores(int id, FormCollection collection) { ReturnResult returnResult = new ReturnResult(); Stores objStores = new Stores(); try { // TODO: Add insert logic here StoresBL objstoresBL = new StoresBL(); objStores.StoreId = id; objStores.StoreName = Convert.ToString(collection["StoreName"]); objStores.Address = Convert.ToString(collection["Address"]); objStores.City = Convert.ToString(collection["City"]); objStores.CompanyId = Convert.ToInt32(collection["CompanyID"]); objStores.ManagedBy = Convert.ToString(collection["ManagedBy"]); objStores.Phone1 = Convert.ToString(collection["Phone1"]); objStores.Phone2 = Convert.ToString(collection["Phone2"]); objStores.Email = Convert.ToString(collection["Email"]); returnResult = objstoresBL.SaveStores(objStores); if (returnResult.IsSuccess) { return(RedirectToAction("Index")); } else { //TempData["CreateCategoryMessage"] = returnResult.Message; return(View()); } } catch { // TempData["CreateCategoryMessage"] = returnResult.Message; return(View()); } }
// DELETE: api/Stores/5 public Result <bool> Delete(int id) { _bl = new StoresBL(); return(_bl.Delete(id)); }
// PUT: api/Stores/5 public Result <StoreDto> Put(int id, [FromBody] StoreDto value) { _bl = new StoresBL(); return(_bl.Update(value)); }
// POST: api/Stores public Result <StoreDto> Post([FromBody] StoreDto value) { _bl = new StoresBL(); return(_bl.Add(value)); }
// GET: api/Stores/5 public Result <StoreDto> Get(int id) { _bl = new StoresBL(); return(_bl.Get(id)); }
// GET: api/Stores public Result <List <StoreDto> > Get() { _bl = new StoresBL(); return(_bl.Get()); }