Ejemplo n.º 1
0
        /// <summary>
        /// Get the details of the current DashboardIndicatorData in the view model by ID
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="type"></param>
        /// <returns></returns>
        public JsonResult GetDashboardIndicatorDataDetails(int id, int type)
        {
            var model = new DashboardIndicatorData {
                IsActive = true, ID = 0
            };

            if (type == 1 && id > 0)
            {
                //Call the AddDashboardIndicatorData Method to Add / Update current DashboardIndicatorData
                using (var bal = new DashboardIndicatorDataBal())
                    model = bal.GetDashboardIndicatorDataById(id);
            }

            //Pass the ActionResult with the current DashboardIndicatorDataViewModel object as model to PartialView DashboardIndicatorDataAddEdit
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Delete the current DashboardIndicatorData based on the DashboardIndicatorData ID passed in the DashboardIndicatorDataModel
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public ActionResult DeleteDashboardIndicatorData(int id)
        {
            using (var bal = new DashboardIndicatorDataBal())
            {
                //Get DashboardIndicatorData model object by current DashboardIndicatorData ID
                var model = bal.GetDashboardIndicatorDataById(id);
                //var userId = Helpers.GetLoggedInUserId();
                //var currentDate = Helpers.GetInvariantCultureDateTime();
                var list = new List <DashboardIndicatorDataCustomModel>();

                //Check If DashboardIndicatorData model is not null
                if (model != null)
                {
                    model.IsActive = false;

                    //Update Operation of current DashboardIndicatorData
                    list = bal.SaveDashboardIndicatorData(model);
                    //return deleted ID of current DashboardIndicatorData as Json Result to the Ajax Call.
                }
                //Pass the ActionResult with List of DashboardIndicatorDataViewModel object to Partial View DashboardIndicatorDataList
                return(PartialView(PartialViews.DashboardIndicatorDataList, list));
            }
        }