예제 #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));
            }
        }
예제 #2
0
        public ActionResult Index()
        {
            StoresBL StoreBL = new StoresBL();

            var Stores = StoreBL.GetStores();

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