Example #1
0
        public IHttpActionResult PostStore_Details(Store_Details store_Details)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Store_Details.Add(store_Details);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (Store_DetailsExists(store_Details.storeId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = store_Details.storeId }, store_Details));
        }
        // GET: Store/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ViewBag.MasterStoreList = from m in db.Store_Details
                                      where m.MasterStoreId == 0
                                      select new SelectListItem
            {
                Value = m.storeId.ToString(),
                Text  = m.storename
            };


            Store_Details storeDetail = db.Store_Details.Find(id);
            var           config      = new MapperConfiguration(cfg => {
                cfg.CreateMap <Store_Details, StoreDetails>();
            });

            IMapper mapper = config.CreateMapper();

            var dest = mapper.Map <Store_Details, StoreDetails>(storeDetail);

            if (storeDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(dest));
        }
Example #3
0
        public IHttpActionResult PutStore_Details(int id, Store_Details store_Details)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != store_Details.storeId)
            {
                return(BadRequest());
            }

            db.Entry(store_Details).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Store_DetailsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Store_Details storeDetail = db.Store_Details.Find(id);

            db.Store_Details.Remove(storeDetail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #5
0
 public ActionResult Edit([Bind(Include = "storeId,storename")] Store_Details storeDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(storeDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(storeDetail));
 }
Example #6
0
        public IHttpActionResult GetStore_Details(int id)
        {
            Store_Details store_Details = db.Store_Details.Find(id);

            if (store_Details == null)
            {
                return(NotFound());
            }

            return(Ok(store_Details));
        }
        // GET: Store/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Store_Details storeDetail = db.Store_Details.Find(id);

            if (storeDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(storeDetail));
        }
Example #8
0
        public IHttpActionResult DeleteStore_Details(int id)
        {
            Store_Details store_Details = db.Store_Details.Find(id);

            if (store_Details == null)
            {
                return(NotFound());
            }

            db.Store_Details.Remove(store_Details);
            db.SaveChanges();

            return(Ok(store_Details));
        }
Example #9
0
        // GET: Store/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Store_Details storeDetail = db.Store_Details.Find(id);
            var           config      = new MapperConfiguration(cfg => {
                cfg.CreateMap <Store_Details, StoreDetails>();
            });

            IMapper mapper = config.CreateMapper();

            var dest = mapper.Map <Store_Details, StoreDetails>(storeDetail);

            if (storeDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(dest));
        }