public async Task <TicketOwnerDTO> AddOwner(TicketOwnerDTO ticketOwner) { await Task.Run(() => { var newTicketOwner = new Grievance.DAL.TicketOwner() { CreatedBy = "System", CreatedDate = DateTime.Now, EmailAddress = ticketOwner.EmailAddress, Gender = ticketOwner.Gender, IDNumber = ticketOwner.IDNumber, Latitude = ticketOwner.Latitude, Longitude = ticketOwner.Longitude, Name = ticketOwner.Name, PhoneNumber = ticketOwner.PhoneNumber, PhysicalAddress = ticketOwner.PhysicalAddress, Surname = ticketOwner.Surname, TicketTypeId = ticketOwner.TicketTypeId, UpdatedBy = "System", UpdatedDate = DateTime.Now }; _ctx.TicketOwners.Add(newTicketOwner); _ctx.SaveChanges(); ticketOwner.Id = newTicketOwner.Id; ticketOwner.TicketTypeId = newTicketOwner.TicketTypeId; }); return(ticketOwner); }
public async Task <TicketOwnerDTO> AddOwners(TicketOwnerDTO ticketOwner) { //ticketOwner.CreatedBy = currentUser; //ticketOwner.UpdatedBy = currentUser; //ticketOwner.CreatedDate = currentDateTime; //ticketOwner.UpdatedDate = currentDateTime; var newTicketOwner = await _dataProvider.AddOwner(ticketOwner); return(newTicketOwner); }