public async Task <IActionResult> CreateTicketType([FromForm] TicketTypeCM ticketType) { try { var TicketType = new TicketType { Name = ticketType.Name, AdultPrice = ticketType.AdultPrice, ChildrenPrice = ticketType.ChildrenPrice, AtrractionId = ticketType.AtrractionId, CreateAt = DateTime.Now }; _ITicketTypeService.AddTicketType(TicketType); await _ITicketTypeService.SaveTicketType(); IList <IFormFile> imageUpload = ticketType.ImageUpload.ToList(); List <String> listImage = new List <string>(); if (imageUpload.Count > 0) { for (int i = 0; i < imageUpload.Count; i++) { var file = imageUpload[i]; var link = await _iUploadFile.uploadFile(file, TicketType.Id.ToString()); listImage.Add(link); } } TicketType.UrlImage = String.Join(";", listImage); _ITicketTypeService.UpdateTicketType(TicketType); bool result = await _ITicketTypeService.SaveTicketType(); if (!result) { return(BadRequest("Can not create TicketType")); } return(StatusCode(201, new { Id = TicketType.Id })); } catch (Exception e) { return(BadRequest(e.Message)); } }