public Momcadi MapMomcadViewToMomcad(MomcadView view) { var result = new Momcadi() { Id = view.Id, Naziv = view.Naziv, KlubId = view.Klub.Id }; return(result); }
public bool AddMomcad(Momcadi momcad) { try { _context.Momcadi.Add(momcad); _context.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public MomcadView MapMomcadToBasicMomcad(Momcadi momcad) { var result = new MomcadView { Id = momcad.Id, Naziv = momcad.Naziv, Klub = new KlubView() { Id = momcad.Klub.Id, Naziv = momcad.Klub.Naziv } }; return(result); }
public bool UpdateMomcad(Momcadi momcad) { int id; var momcad1 = _context.Momcadi.SingleOrDefault(v => v.Id == momcad.Id); id = momcad.Id; momcad1.Naziv = momcad.Naziv; momcad1.KlubId = momcad.KlubId; try { _context.SaveChanges(); return(true); } catch (Exception e) { return(false); } }