コード例 #1
0
        public JsonResult GetStoneDetail(int stoneId)
        {
            Stone          stone          = StoneDbModel.GetStoneModel(stoneId);
            StoneViewModel stoneviewModel = helper.GetViewModelFromDbStone(stone);

            return(Json(stoneviewModel, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult SaveStone(StoneViewModel stoneViewModel)
        {
            string message = "";

            try
            {
                if (stoneViewModel != null)
                {
                    Stone stone = helper.GetStoneObjectFromViewModelStone(stoneViewModel);
                    if (stone != null)
                    {
                        if (stone.StoneId > 0)
                        {
                            message = "Stone details updated successfully";
                            StoneDbModel.UpdateStone(stone);
                        }
                        else
                        {
                            message = "Stone created successfully";
                            StoneDbModel.SaveStone(stone);
                        }
                    }
                    else
                    {
                        message = "Application was not able to create Stone, contact Admin";
                    }
                }
            }
            catch (Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                message = ex.Message;
            }
            return(Json(new { UpdateMessage = message }));
        }
コード例 #3
0
        public ActionResult DisplayAllStone()
        {
            var allStoneFromDb = StoneDbModel.GetAllStonesFromDB();
            List <StoneViewModel> stoneViewModelCollection = helper.GetViewModelFromDbStoneCollection(allStoneFromDb);

            return(View("Stone", stoneViewModelCollection));
        }
コード例 #4
0
        public ActionResult CreateNew()
        {
            List <Stone>    stones     = StoneDbModel.GetAllStonesFromDB();
            List <Finding>  findings   = FindingDbModel.GetAllFindingsFromDB();
            List <Category> categories = CategoryDbModel.GetAllCategoryFromDB();
            ProductItem     item       = new ProductItem();

            item.Stones     = stones;
            item.Findings   = findings;
            item.Categories = categories;

            return(View(item));
        }
コード例 #5
0
        public ActionResult Index()
        {
            List <Stone>    stones            = StoneDbModel.GetAllStonesFromDB();
            List <Finding>  findings          = FindingDbModel.GetAllFindingsFromDB();
            List <Category> categories        = CategoryDbModel.GetAllCategoryFromDB();
            ProductItem     item              = new ProductItem();
            var             productCollection = ProductDbModel.GetAllProduct();

            item.Stones     = stones;
            item.Findings   = findings;
            item.Categories = categories;

            return(View(productCollection));
        }
コード例 #6
0
        public JsonResult DeleteStone(int stoneId)
        {
            string message = "Stone deleted successfuly";

            try
            {
                StoneDbModel.DeleteStone(stoneId);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            }

            return(Json(new { DeleteMessage = message }));
        }