public ActionResult Create(NewRequestModel req) { var user = (UserInfo)Session["user"]; //For login if (user is null) { ViewBag.Position = null; return(View()); } ViewBag.Position = user.Job; if (req.Start > req.End) { ViewBag.alert = "alert('Start Date Cannot be Greater then End Date')"; return(View()); } var req2 = new NewRequest() { Skill = req.Skill, Id = req.Id, Name = req.Name, Start = req.Start, End = req.End, ProjManID = user.Id }; //List<SelectListItem> list = new List<SelectListItem>(); //list.Add(new SelectListItem() { Text = "C#", Value = "C#" }); //list.Add(new SelectListItem() { Text = "C", Value = "C" }); //list.Add(new SelectListItem() { Text = "Python", Value = "Python" }); //ViewBag.list = list; Data.CreateRequest(req2); ViewBag.alert = "alert('Request Created Successfully')"; return(View()); }
public IActionResult AddRereshRequest([FromBody] NewRequestModel newRequest) { var newRequestId = Guid.NewGuid().ToString(); var user = WindowsIdentity.GetCurrent().Name; var dbs = new List <DatabaseLogModel>(); for (var i = 0; i < newRequest.DatabaseNames.Length; i++) { var db = new DatabaseLogModel() { RefreshRequstId = newRequestId, DatabaseName = newRequest.DatabaseNames[i] }; dbs.Add(db); } var request = new RefreshRequestModel() { Id = newRequestId, Environment = newRequest.Environment, Status = "Initiated", Requestor = user, ScheduleDate = DateTime.Now, ScheduledBy = user, Databases = dbs }; _context.RefreshRequests.Add(request); _context.SaveChanges(); return(Ok(request)); }
public IHttpActionResult Draft(NewRequestModel newRequest) { using (_domainContext) { var requestContext = new NewRequestContext { Request = new Request { Message = newRequest.Message, Requester = newRequest.Requester } }; var request = _requestService.CreateDraft(requestContext); _domainContext.SaveChanges(); return(Json(request)); } }