/// <summary> /// Saves the street. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public async Task <int> SaveStreet(EntityStreet entity) { entity.Id = UtilsService.GenerateId(entity.Id); return(await Util.TryAsync(() => GetConnection().InsertOrReplaceAsync(entity), failureMessage : "DataContext failed to load Towns")); }
/// <summary> /// To the model. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> internal static ModelStreet ToModel(this EntityStreet entity) { var model = new ModelStreet(); model.Id = entity.Id; model.SuburbId = entity.SuburbId; model.Name = entity.Name; return(model); }