예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Label label = LabelRepository.GetSingle(id);

            try
            {
                LabelRepository.Delete(label);
                LabelRepository.Save();

                if (IsSuperAdmin)
                {
                    return(RedirectToAction("Index", new { storeId = label.StoreId }));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Unable to delete it:" + ex.StackTrace, label);
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }

            return(View(label));
        }
예제 #2
0
        public ActionResult CreatingNewLabel(String labelName)
        {
            Label label = new Label();

            label.Name     = labelName;
            label.ParentId = 1;

            LabelRepository.Add(label);
            int labelId = LabelRepository.Save();

            label = LabelRepository.GetSingle(labelId);


            return(Json(label, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public ActionResult SaveOrEdit(int id = 0, int selectedStoreId = 0)
        {
            var label = new Label();

            label.StoreId = GetStoreId(selectedStoreId);
            if (id != 0)
            {
                label             = LabelRepository.GetSingle(id);
                label.UpdatedDate = DateTime.Now;
            }
            else
            {
                label.UpdatedDate = DateTime.Now;
                label.CreatedDate = DateTime.Now;
                label.State       = true;
            }
            return(View(label));
        }
예제 #4
0
        public ActionResult Delete(int id)
        {
            Label label = LabelRepository.GetSingle(id);

            return(View(label));
        }
예제 #5
0
        //
        // GET: /Labels/Details/5

        public ViewResult Details(int id)
        {
            Label label = LabelRepository.GetSingle(id);

            return(View(label));
        }