/// <summary>
        /// Add New or Update the DashboardTargets based on if we pass the DashboardTargets ID in the DashboardTargetsViewModel object.
        /// </summary>
        /// <param name="model"></param>
        /// <returns>returns the newly added or updated ID of DashboardTargets row</returns>
        public ActionResult SaveDashboardTargets(DashboardTargets model)
        {
            //Initialize the newId variable
            var userId      = Helpers.GetLoggedInUserId();
            var currentDate = Helpers.GetInvariantCultureDateTime();
            var list        = new List <DashboardTargetsCustomModel>();

            //Check if Model is not null
            if (model != null)
            {
                using (var bal = new DashboardTargetsBal())
                {
                    if (model.TargetId > 0)
                    {
                        model.ModifiedBy   = userId;
                        model.ModifiedDate = currentDate;
                    }
                    else
                    {
                        model.CreatedBy   = userId;
                        model.CreatedDate = currentDate;
                    }

                    //Call the AddDashboardTargets Method to Add / Update current DashboardTargets
                    list = bal.SaveDashboardTargets(model);
                }
            }

            //Pass the ActionResult with List of DashboardTargetsViewModel object to Partial View DashboardTargetsList
            return(PartialView(PartialViews.DashboardTargetsList, list));
        }
        /// <summary>
        /// Method to add/Update the Entity in the database.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public List <DashboardTargetsCustomModel> SaveDashboardTargets(DashboardTargets model)
        {
            List <DashboardTargetsCustomModel> list;

            using (var rep = UnitOfWork.DashboardTargetsRepository)
            {
                if (model.TargetId > 0)
                {
                    var current = rep.GetSingle(model.TargetId);
                    model.CreatedBy   = current.CreatedBy;
                    model.CreatedDate = current.CreatedDate;
                    rep.UpdateEntity(model, model.TargetId);
                }
                else
                {
                    rep.Create(model);
                }

                list = GetDashboardTargetsList(model.CorporateId, model.FacilityId);
            }
            return(list);
        }