public void UpdateDostavka(DostavkaModel c) { Dostavka c1 = db.Dostavka.Where(i => i.Id == c.Id).FirstOrDefault(); db.Entry(toDostavka(c1, c)).State = EntityState.Modified; db.SaveChanges(); }
public Dostavka toDostavka(Dostavka d, DostavkaModel d1) { d.Courier = d1.Courier; d.Data_viezda = d1.Data_viezda; d.Id = d1.Id; d.OplataZaKm = d1.OplataZaKm; d.Transport = d1.Transport; return(d); }
private DostavkaModel toDostavkaModel(Dostavka i) { return(new DostavkaModel { Id = i.Id, Courier = i.Courier, CourierName = db.Courier.Where(y => y.Id == i.Courier).FirstOrDefault().FirstName + ' ' + db.Courier.Where(y => y.Id == i.Courier).FirstOrDefault().LastName + ' ' + db.Courier.Where(y => y.Id == i.Courier).FirstOrDefault().MiddleName, Data_viezda = i.Data_viezda, OplataZaKm = i.OplataZaKm, Transport = i.Transport, TransportName = db.Transport.Where(y => y.Id == i.Transport).FirstOrDefault().Mark + ' ' + db.Transport.Where(y => y.Id == i.Transport).FirstOrDefault().Number }); }