public ActionResult Finding()
        {
            var allFindings = FindingDbModel.GetAllFindingsFromDB();
            ProductFindingViewModel productFindingViewModel = helper.ConvertFindingToViewModel(allFindings);

            return(View(productFindingViewModel));
        }
        public JsonResult SaveFinding(Finding finding)
        {
            string message = "";

            try
            {
                if (finding != null)
                {
                    if (finding.FindingId > 0)
                    {
                        message = "Finding updated successfully";
                        FindingDbModel.UpdateFinding(finding);
                    }
                    else
                    {
                        message = "Finding created successfully";
                        FindingDbModel.SaveFinding(finding);
                    }
                }
            }
            catch (Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                message = "Finding updation failed : " + ex.Message;
            }
            return(Json(new { UpdateMessage = message }));
        }
        public JsonResult GetFindingDetail(int findingId)
        {
            Finding        finding          = FindingDbModel.GetFindingModel(findingId);
            ProductFinding viewModelFinding = helper.GetViewModelProductFindingFromDbFinding(finding);

            return(Json(viewModelFinding, JsonRequestBehavior.AllowGet));
        }
        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));
        }
        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));
        }
        public JsonResult DeleteFinding(int findingId)
        {
            string message = "Finding deleted successfuly";

            try
            {
                FindingDbModel.DeleteFinding(findingId);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            }

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