Esempio n. 1
0
        // 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));
            }
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            StoresBL StoreBL = new StoresBL();

            var Stores = StoreBL.GetStores();

            return(View(Stores));
        }
Esempio n. 3
0
        //[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();
        }
Esempio n. 4
0
        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());
            }
        }
Esempio n. 5
0
 // DELETE: api/Stores/5
 public Result <bool> Delete(int id)
 {
     _bl = new StoresBL();
     return(_bl.Delete(id));
 }
Esempio n. 6
0
 // PUT: api/Stores/5
 public Result <StoreDto> Put(int id, [FromBody] StoreDto value)
 {
     _bl = new StoresBL();
     return(_bl.Update(value));
 }
Esempio n. 7
0
 // POST: api/Stores
 public Result <StoreDto> Post([FromBody] StoreDto value)
 {
     _bl = new StoresBL();
     return(_bl.Add(value));
 }
Esempio n. 8
0
 // GET: api/Stores/5
 public Result <StoreDto> Get(int id)
 {
     _bl = new StoresBL();
     return(_bl.Get(id));
 }
Esempio n. 9
0
 // GET: api/Stores
 public Result <List <StoreDto> > Get()
 {
     _bl = new StoresBL();
     return(_bl.Get());
 }