public void CreatePhoneNumber(long id, ClientPhoneNumberPoco phonenumber) { ClientPoco c = _db.Clients.Single(cust => cust.Id == id); c.PhoneNumbers.Add(phonenumber); _db.SaveChanges(); }
public void DeleteClient(long id) { ClientPoco c = _db.Clients.Find(id); _db.Clients.Remove(c); _db.SaveChanges(); }
public void CreateAddress(long id, ClientAddressPoco address) { ClientPoco c = _db.Clients.Single(cust => cust.Id == id); c.Addresses.Add(address); _db.SaveChanges(); }
/// <summary> /// Return all dtos mapped from the entities. /// </summary> /// <returns>This returns a list of entities</returns> public async Task <IEnumerable <ClientDto> > LoadAsyncAll() { IEnumerable <ClientDto> dtoCollection = new ObservableCollection <ClientDto>(); using (var conn = _sqlExecutor.OpenNewDbConnection()) { var cli1 = await conn.GetAsyncAll <CLIENTES1>(); var cli2 = await conn.GetAsyncAll <CLIENTES2>(); var poco1 = _mapper.Map <IEnumerable <CLIENTES1>, IEnumerable <ClientPoco> >(cli1); var poco2 = _mapper.Map <IEnumerable <CLIENTES2>, IEnumerable <ClientPoco> >(cli2); var sortedPoco1 = poco1.OrderBy(x => x.NUMERO_CLI); var sortedPoco2 = poco2.OrderBy(x => x.NUMERO_CLI); IEnumerator <ClientPoco> iter = sortedPoco2.GetEnumerator(); var second = iter.Current; var mergedValue = new List <ClientPoco>(); foreach (var p in sortedPoco1) { MergePOCO <ClientPoco> merger = new MergePOCO <ClientPoco>(); IDictionary <string, ClientPoco> ctx = new Dictionary <string, ClientPoco>(); ctx.Add(MergePOCO <ClientPoco> .EntityName, second); ClientPoco poco = merger.Convert(p, ctx); iter.MoveNext(); second = iter.Current; mergedValue.Add(poco); } dtoCollection = _mapper.Map <IEnumerable <ClientPoco>, IEnumerable <ClientDto> >(mergedValue, dtoCollection); iter.Dispose(); } return(dtoCollection); }
public static ClientPoco GetClients(string ClientID) { ClientPoco g = null; g = GetClients().FirstOrDefault(c => c.ClientUserName == ClientID); return(g); }
public void DeleteAddress(long clientid, long addressid) { ClientAddressPoco a = _db.ClientAddresses.Single(ad => ad.AddressId == addressid); ClientPoco c = _db.Clients.Single(cust => cust.Id == clientid); c.Addresses.Remove(a); _db.SaveChanges(); }
public void DeletePhoneNumber(long clientid, long phonenumberid) { ClientPhoneNumberPoco p = _db.ClientPhones.Single(ph => ph.PhoneNumberId == phonenumberid); ClientPoco c = _db.Clients.Single(cust => cust.Id == clientid); c.PhoneNumbers.Remove(p); _db.SaveChanges(); }
public void UpdatePhoneNumber(long clientId, long PhoneNumberId, ClientPhoneNumberPoco phonenumber) { ClientPoco c = _db.Clients.Single(cu => cu.Id == clientId); ClientPhoneNumberPoco p = c.PhoneNumbers.Single(pn => pn.PhoneNumberId == PhoneNumberId); p.PhoneNo = phonenumber.PhoneNo; p.PhoneType = phonenumber.PhoneType; _db.SaveChanges(); }
public void UpdateClient(ClientPoco client) { ClientPoco c = _db.Clients.Single(cu => cu.Id == client.Id); c.FirstName = client.FirstName; c.LastName = client.LastName; c.DoB = client.DoB; c.SocialIns = client.SocialIns; _db.SaveChanges(); }
public void UpdateAddress(long clientId, long addressId, ClientAddressPoco address) { ClientPoco c = _db.Clients.Single(cu => cu.Id == clientId); ClientAddressPoco a = c.Addresses.Single(ad => ad.AddressId == addressId); a.Street = address.Street; a.Province = address.Province; a.City = address.City; a.Postal_Code = address.Postal_Code; _db.SaveChanges(); }
public static ClientPoco Map(Client client) { var result = new ClientPoco { ClientUserName = client.ClientId, Description = client.Description, Secret = "", AccessTokenType = MapTokenType(client.AccessTokenType), AccessTokenLifeTime = client.AccessTokenLifetime, ApiScopes = MapClientScopes(client.AllowedScopes, client.ClientId), // Claims }; return(result); }
public static Client Map(ClientPoco poco) { var result = new Client { // TODO hard coded configuration AlwaysSendClientClaims = true, AlwaysIncludeUserClaimsInIdToken = true, AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials, // TODO Db Configuration ClientId = poco.ClientUserName, ClientName = poco.ClientUserName, Description = poco.Description, ClientSecrets = { new Secret((poco.Secret).Sha256()) }, AccessTokenType = MapTokenType(poco.AccessTokenType), AccessTokenLifetime = poco.AccessTokenLifeTime, AllowedScopes = MapClientScopes(poco.ApiScopes), // TODO need to add userclaims here // Claims }; return(result); }
public void Create(ClientPoco client) { _repository.Create(client); }
public void Create(ClientPoco client) { _db.Clients.Add(client); _db.SaveChanges(); }
public HttpResponseMessage CreateClient([FromBody] ClientPoco client) { _logic.Create(client); _log.Debug("Creating new client."); return(Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage UpdateClient([FromBody] ClientPoco client) { _logic.UpdateClient(client); return(Request.CreateResponse(HttpStatusCode.OK)); }
public void UpdateClient(ClientPoco client) { _repository.UpdateClient(client); }
public void UpdateClient(ClientPoco client) { throw new NotImplementedException(); }
public void Create(ClientPoco client) { throw new NotImplementedException(); }