public MatchyBackend.Branche mapToService(Branche branche) { MatchyBackend.Branche result = new MatchyBackend.Branche(); if (branche != null) { return new MatchyBackend.Branche() { branche_ID = branche.branche_ID, Description = branche.Description }; } else return result; }
public Branche mapFromService(MatchyBackend.Branche branche) { if (branche.branche_ID != 0) { return new Branche() { branche_ID = branche.branche_ID, Description = branche.Description }; } else { Branche result = new Branche(); return result; } }
public virtual Branche Update(Branche entity) { this.Context.Entry <Branche>(entity).State = EntityState.Modified; Context.SaveChanges(); return(GetById(entity.Id)); }
public bool Delete(Branche entity) { this.DbEntitySet.Remove(entity); return(Context.SaveChanges() > 0); }
public Branche Create(Branche entity) { entity = this.DbEntitySet.Add(entity); Context.SaveChanges(); return(entity); }
public async Task <ActionResult <User> > LogIn(UserDTO model) { if (string.IsNullOrEmpty(model.Email) || string.IsNullOrEmpty(model.Password)) { return(Ok(new { message = "Login ou Mot sont vide", code = -4 })); } var user = await _context.Users.SingleOrDefaultAsync(x => x.Email == model.Email); if (user == null) { return(Ok(new { message = "Login érroné, vous pouvez utiliser l'option de réinitialisation de mot de passe.", code = -3 })); } if (user.Password != model.Password) { return(Ok(new { message = "Mot de passe érroné, vous pouvez utiliser l'option de réinitialisation de mot de passe.", code = -1 })); } // remove password before returning user.Password = ""; // await _context.Entry(model).Reference(e => e.Role).LoadAsync(); object child = null; NiveauScolaire niveau = null; Branche branche = null; if (user.Role == "student") { child = await _context.Students.Where(e => e.IdUser == user.Id).FirstOrDefaultAsync() as Student; if (child != null) { niveau = await _context.NiveauScolaires.Where(e => e.Id == ((Student)child).Niveau).FirstOrDefaultAsync(); if (((Student)child).Branche != 0) { branche = await _context.Branches.Where(e => e.Id == ((Student)child).Branche).FirstOrDefaultAsync(); } } } else { child = await _context.Profs.Where(e => e.IdUser == user.Id).FirstOrDefaultAsync() as Prof; } if (user.IsActive == false) { return(Ok(new { message = "Veuillez patienter que votre compte soit active par l'administration", code = -2 })); } var claims = new Claim[] { new Claim(ClaimTypes.Name, user.Id.ToString()), new Claim(ClaimTypes.Email, user.Email), // new Claim(ClaimTypes.Role, user.Role.ToString()), }; return(Ok(new { code = 1, child, niveau, branche, user, token = _tokkenHandler.GenerateTokken(claims), message = "connexion réussite" })); }
public Lieferant() { FirmenName = ""; Adresse = new Adresse(); Branche = new Branche(); }
public Lieferant(string firmenname, Adresse adresse, Branche branche) { FirmenName = firmenname; Adresse = adresse; Branche = branche; }