public IActionResult Create(web_db._temp.TblTemp temp) { if (ModelState.IsValid && (temp.FkuserTaiid.HasValue == false)) { var xx = db.TblTemps.Any(a => (a.Date == temp._Date.ToDate() && (a.Id != temp.Id)) && a.FkSalMali == User._getuserSalMaliDef() ); if (xx == false) { var x = db.TblTemps.Any(a => a.Id == temp.Id); if (x == false) { temp.Id = Guid.NewGuid(); temp.FkuserAdd = User._getuserid().Value; temp.FkSalMali = User._getuserSalMaliDef(); db.TblTemps.Add(temp); } else { db.TblTemps.Update(temp); } db.SaveChanges(); return(RedirectToAction(nameof(Index))); } } return(View(temp)); }
public IActionResult Create(Guid?id) { var x = db.TblTemps.Find(id); if (x == null) { x = new web_db._temp.TblTemp(); } return(View(x)); }