コード例 #1
0
        /// <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"));
        }
コード例 #2
0
        /// <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);
        }