public Call CreateCall(Call newCall, string userId) { newCall.dataDodania = DateTime.Now; newCall.UserID = userId; db.Calls.Add(newCall); db.SaveChanges(); return(newCall); }
public ActionResult CallInfo(SzczegolyPolaczeniaViewModel vmCall) { if (ModelState.IsValid) { Call polaczenie = db.Calls.Where(c => c.id_call == vmCall.callID).Single(); polaczenie.status = vmCall.StatusSprawy; db.SaveChanges(); return(RedirectToAction("CallList", "Call")); } else { return(View(vmCall)); } }
public ActionResult Form(FormularzViewModel model) { SpisContext DTB = new SpisContext(); if (ModelState.IsValid) { int id = (from p in DTB.Phones where p.phone_number == model.PHONE_NUMBER select p.id_phone).First(); var DK = model.DoKogo; var TO = model.TelefonyUsera; var userID = User.Identity.GetUserId(); //int myChosePhone=100; //string a = model.SelectedTelefon; //int parsedInt = 0; //if (int.TryParse(a, out parsedInt)) // myChosePhone = parsedInt; Call call = new Call { date = model.Date, description = model.Description, callerName = model.NameCaller, callerLastName = model.LastNaemCaller, status = false, adresseID = model.SelectedDoKogo, caller_number = model.PHONE_NUMBER_CALLER, id_phone = id, dataDodania = DateTime.Now, UserID = userID, }; DTB.Calls.Add(call); DTB.SaveChanges(); //var newCall = CallMenager.CreateCall(call, userID); return(RedirectToAction("CallList_TylkoDlaMnie", "Call")); } else { return(View(model)); } }