public DTOs.Customer Update(int id, DTOs.Customer customer) { Customer existingCustomer = Get(id); existingCustomer.FirstName = customer.FirstName ?? existingCustomer.FirstName; existingCustomer.LastName = customer.LastName ?? existingCustomer.LastName; existingCustomer.Username = customer.Username ?? existingCustomer.Username; existingCustomer.Password = customer.Password ?? existingCustomer.Password; existingCustomer.Email = customer.Email ?? existingCustomer.Email; if (customer.BirthDate != null) { existingCustomer.BirthDate = customer.BirthDate; } if (customer.Region != null) { existingCustomer.Region = _decodesQueryProcessor.Get <RegionDecode>(customer.Region); } if (customer.FreezeDate != null) { existingCustomer.FreezeDate = customer.FreezeDate; } Update(id, existingCustomer); return(new DTOs.Customer().Initialize(existingCustomer)); }
public override Participant Initialize(Domain.Participant domain) { Id = domain.Id; Customer = new DTOs.Customer().Initialize(domain.Customer); Date = domain.Date; Order = new DTOs.Order().Initialize(domain.Order); Status = domain.Status.Id; return(this); }
public override Order Initialize(Domain.Order domain) { Id = domain.Id; StartDate = DateUtils.ConvertToJavaScript(domain.StartDate); Owner = new DTOs.Customer().Initialize(domain.Owner); PlayersNumber = domain.PlayersNumber; Status = domain.Status.Id; Field = new DTOs.Field().Initialize(domain.Field); return(this); }
public override Review Initialize(Domain.Review domain) { Id = domain.Id; Title = domain.Title; Description = domain.Description; Date = domain.Date; Reviewer = new DTOs.Customer().Initialize(domain.Reviewer); ReviewedCustomer = new DTOs.Customer().Initialize(domain.ReviewedCustomer);; return(this); }
public override Complaint Initialize(Domain.Complaint domain) { Id = domain.Id; Description = domain.Description; Type = domain.Type.Id; Date = domain.Date; OffendingCustomer = new DTOs.Customer().Initialize(domain.OffendingCustomer); OffendedCustomer = new DTOs.Customer().Initialize(domain.OffendedCustomer); return(this); }
public static Models.Customer CreateFrom(DTOs.Customer customer) { return(new Models.Customer() { Id = customer.Id, Name = customer.Name, GenderId = customer.Gender.Id, HouseNumber = customer.HouseNumber, AddressLine1 = customer.AddressLine1, State = customer.State, CountryId = customer.Country.Id, CategoryId = customer.Category.Id, DateOfBirth = customer.DateOfBirth, User = "******" }); }
public RegistrationReponse Registration(DTOs.Customer customer) { if (_customersQueryProcessor.Exists(customer.Username)) { return(new RegistrationReponse { AlreadyExists = true }); } _customersQueryProcessor.Save(customer); return(new RegistrationReponse() { AlreadyExists = false }); }
public IEnumerable <OffendingCustomersReport> GetOffendingCustomersReport(DateTime?fromDate, DateTime?untilDate, int?complaintType) { var complaintsGrouping = _complaintsQueryProcessor.Search(null, fromDate, untilDate, complaintType).GroupBy(x => x.OffendingCustomer.Id, x => x.OffendedCustomer.Id); List <OffendingCustomersReport> offendingList = new List <OffendingCustomersReport>(); foreach (var item in complaintsGrouping) { DTOs.Customer customer = _customersQueryProcessor.GetCustomer(item.Key ?? 0); offendingList.Add(new OffendingCustomersReport() { CustomerId = customer.Id ?? 0, FirstName = customer.FirstName, LastName = customer.LastName, NumberOfComplaints = item.Count() }); } return(offendingList); }
public DTOs.Customer Save(DTOs.Customer customer) { Customer newCustomer = new Customer { FirstName = customer.FirstName, LastName = customer.LastName, Username = customer.Username, Password = customer.Password, BirthDate = customer.BirthDate, Email = customer.Email, Region = _decodesQueryProcessor.Get <RegionDecode>(customer.Region), FreezeDate = customer.FreezeDate }; Customer persistedCustomer = Save(newCustomer); return(new DTOs.Customer().Initialize(persistedCustomer)); }
public DTOs.CustomerUpdateResponse Update(int id, [FromBody] DTOs.Customer customer) { string authenticationKey = null; var currPrincipal = HttpContext.Current.User as ClaimsPrincipal; var currIdentity = currPrincipal.Identity as BasicAuthenticationIdentity; if (currIdentity.Claims.Contains(new Claim(ClaimTypes.Role, Consts.Roles.Customer), _userTypeComparer)) { byte[] toEncodeAsBytes = ASCIIEncoding.ASCII.GetBytes(customer.Username + ":" + customer.Password); authenticationKey = "Basic " + Convert.ToBase64String(toEncodeAsBytes); } return(new DTOs.CustomerUpdateResponse { Customer = _customersQueryProcessor.Update(id, customer), AuthenticationKey = authenticationKey }); }
public DTOs.Customer Save([FromBody] DTOs.Customer customer) { return(_customersQueryProcessor.Save(customer)); }