Example #1
0
        /// <summary>
        /// Add New or Update the DashboardDisplayOrder based on if we pass the DashboardDisplayOrder ID in the DashboardDisplayOrderViewModel object.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// returns the newly added or updated ID of DashboardDisplayOrder row
        /// </returns>
        public ActionResult SaveDashboardDisplayOrder(DashboardDisplayOrder model)
        {
            //Initialize the newId variable
            var userId      = Helpers.GetLoggedInUserId();
            var currentDate = Helpers.GetInvariantCultureDateTime();
            var list        = new List <DashboardDisplayOrderCustomModel>();

            //Check if Model is not null
            if (model != null)
            {
                var corporateid = Helpers.GetSysAdminCorporateID();
                model.CorporateId = corporateid;
                using (var bal = new DashboardDisplayOrderBal())
                {
                    if (model.Id > 0)
                    {
                    }
                    else
                    {
                        model.CreatedBy   = userId;
                        model.CreatedDate = currentDate;
                    }

                    //Call the AddDashboardDisplayOrder Method to Add / Update current DashboardDisplayOrder
                    list = bal.SaveDashboardDisplayOrder(model);
                }
            }

            //Pass the ActionResult with List of DashboardDisplayOrderViewModel object to Partial View DashboardDisplayOrderList
            return(PartialView(PartialViews.DashboardDisplayOrderList, list));
        }
Example #2
0
        /// <summary>
        /// Method to add/Update the Entity in the database.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public List <DashboardDisplayOrderCustomModel> SaveDashboardDisplayOrder(DashboardDisplayOrder model)
        {
            using (var rep = UnitOfWork.DashboardDisplayOrderRepository)
            {
                if (model.Id > 0)
                {
                    var current = rep.GetSingle(model.Id);
                    model.CreatedBy   = current.CreatedBy;
                    model.CreatedDate = current.CreatedDate;
                    rep.UpdateEntity(model, model.Id);
                }
                else
                {
                    rep.Create(model);
                }

                var list = GetDashboardDisplayOrderList(model.CorporateId);
                return(list);
            }
        }