public static PermitTypesModel EntityToModel(this PermitTypes entity, bool virtualActive = false) { try { PermitTypesModel model = new PermitTypesModel() { Description=entity.Description, IsPaid=entity.IsPaid, Name=entity.Name, IsActive = entity.IsActive, Id = entity.Id }; if (virtualActive) { model.Permits = entity.Permits; } return model; } catch (Exception) { return new PermitTypesModel(); } }
public ActionResult PermitTypeInsert(PermitTypesModel permitTypes) { PermitTypes permitType = permitTypes.ModelToEnity(); permitType.IsActive = true; _servicePermitTypes.Insert(permitType); return RedirectToAction("PermitTypeList"); }