public void Update(PropertyPricingTypesView model, int CoreSystemUserId) { try { using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext()) { DataAccess.PropertyListingPricingType table = db.PropertyListingPricingTypes.FirstOrDefault(x => x.PropertyListingPricingTypeId == model.PropertyListingPricingTypeId); LoadEditLogDetails(table.PropertyListingPricingTypeId, CoreSystemUserId); JazMax.BusinessLogic.ChangeLog.ChangeLogService.LogChange(table.TypeName, model.TypeName, "Property Price Type"); if (table != null) { table.IsActive = true; table.TypeName = model.TypeName; db.SaveChanges(); } } } catch (Exception e) { JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0); } }
public PropertyPricingTypesView GetById(int?Id) { PropertyPricingTypesView model = null; try { if (Id != null) { using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext()) { model = (db.PropertyListingPricingTypes.Where(x => x.PropertyListingPricingTypeId == Id).Select(x => new PropertyPricingTypesView { IsActive = x.IsActive, PropertyListingPricingTypeId = x.PropertyListingPricingTypeId, TypeName = x.TypeName })).FirstOrDefault(); return(model); } } } catch (Exception e) { JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0); } return(model); }
public JsonResult CreateType(string txtTypeName) { try { PropertyPricingTypesView model = new PropertyPricingTypesView() { TypeName = txtTypeName }; 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(PropertyPricingTypesView model) { try { using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext()) { DataAccess.PropertyListingPricingType table = new DataAccess.PropertyListingPricingType() { IsActive = true, TypeName = model.TypeName }; db.PropertyListingPricingTypes.Add(table); db.SaveChanges(); } } catch (Exception e) { JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0); } }