// GET: Features public ActionResult Features() { var AdminFeatureList = db.Admin_Features_Activation.ToList(); FeaturesViewModels Model = new FeaturesViewModels(); Model.DigitalSignatureForTechnician = AdminFeatureList.Where(x => x.Features.Equals ("Access of Digital Signature for technician / lead Technician"))?.FirstOrDefault()?.Status == "Enable" ? true : false; Model.DigitalSignatureForTenant = AdminFeatureList.Where(x => x.Features.Equals ("Access of Digital Signature for tenant"))?.FirstOrDefault()?.Status == "Enable" ? true : false; Model.ServiceRequest = AdminFeatureList.Where(x => x.Features.Equals ("Access of Service Request Page for technician / lead Technician"))?.FirstOrDefault()?.Status == "Enable" ? true : false; Model.WorkOrderAssigning = AdminFeatureList.Where(x => x.Features.Equals ("Auto Work order assigning to technician / lead Technician"))?.FirstOrDefault()?.Status == "Enable" ? true : false; return(View(Model)); }
public ActionResult Features(FeaturesViewModels Model) { if (ModelState.IsValid) { db.Database.ExecuteSqlCommand( "update[dbo].[Admin_Features_Activation] set Status ='" + (Model.ServiceRequest == true ? "Enable" : "Disable") + "' where Features = 'Access of Service Request Page for technician / lead Technician'"); db.Database.ExecuteSqlCommand( "update[dbo].[Admin_Features_Activation] set Status ='" + (Model.DigitalSignatureForTenant == true ? "Enable" : "Disable") + "' where Features = 'Access of Digital Signature for tenant'"); db.Database.ExecuteSqlCommand( "update[dbo].[Admin_Features_Activation] set Status ='" + (Model.DigitalSignatureForTechnician == true ? "Enable" : "Disable") + "' where Features = 'Access of Digital Signature for technician / lead Technician'"); db.Database.ExecuteSqlCommand( "update[dbo].[Admin_Features_Activation] set Status ='" + (Model.WorkOrderAssigning == true ? "Enable" : "Disable") + "' where Features = 'Auto Work order assigning to technician / lead Technician'"); } else { string Message = string.Empty; foreach (ModelState modelState in ViewData.ModelState.Values) { foreach (ModelError error in modelState.Errors) { Message = error.ErrorMessage; } } ModelState.AddModelError(string.Empty, Message); } return(View()); }