예제 #1
0
        public async Task <IHttpActionResult> AddTransport([FromBody] UpdateTransportRequest createRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _transportRepositoryService.AddEntityAsync(createRequest);

            return(Ok());
        }
예제 #2
0
        public async Task <IHttpActionResult> UpdateTransport([FromUri] int id, [FromBody] UpdateTransportRequest updateRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _transportRepositoryService.UpdateEntityAsync(updateRequest, id);

            return(Ok());
        }
예제 #3
0
        public bool Update(Transport el)
        {
            IRequest request = new UpdateTransportRequest();

            try
            {
                using (var connection = new SqlConnection(connectionString))
                {
                    connection.Execute(request.Sql, el);
                }
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }