public PropertyFeatureView GetById(int?Id) { PropertyFeatureView model = null; try { if (Id != null) { using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext()) { model = (db.PropertyFeatures.Where(x => x.PropertyFeatureId == Id).Select(x => new PropertyFeatureView { FeatureName = x.FeatureName, IsFeatureActive = x.IsFeatureActive, PropertyFeatureId = x.PropertyFeatureId })).FirstOrDefault(); return(model); } } } catch (Exception e) { JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0); } return(model); }
public void Update(PropertyFeatureView model, int CoreSystemUserId) { try { using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext()) { DataAccess.PropertyFeature table = db.PropertyFeatures.FirstOrDefault(x => x.PropertyFeatureId == model.PropertyFeatureId); LoadEditLogDetails(table.PropertyFeatureId, CoreSystemUserId); JazMax.BusinessLogic.ChangeLog.ChangeLogService.LogChange(table.FeatureName, model.FeatureName, "Feature Name"); if (table != null) { table.IsFeatureActive = true; table.FeatureName = model.FeatureName; db.SaveChanges(); } } } catch (Exception e) { JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0); } }
public JsonResult CreateFeature(string txtFeature) { try { PropertyFeatureView model = new PropertyFeatureView() { FeatureName = txtFeature }; o.Create(model); return(Json(new { Result = "Success", Message = "Saved Successfully" }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { Result = "Error!", Message = "Please try again" }, JsonRequestBehavior.AllowGet)); } }
public void Create(PropertyFeatureView model) { try { using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext()) { DataAccess.PropertyFeature table = new DataAccess.PropertyFeature() { IsFeatureActive = true, FeatureName = model.FeatureName }; db.PropertyFeatures.Add(table); db.SaveChanges(); } } catch (Exception e) { JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0); } }