public IActionResult DefineWebSite(WebSiteDto model) { ViewBag.StatusList = GetStatusList.GetList(); if (!ModelState.IsValid) { return(View(model)); } var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; model.UserId = Convert.ToInt32(userId); _webSiteService.CreateOrUpdate(model); return(RedirectToAction("WebSiteList", "Home")); }
/// <summary> /// Creates or Updates the list of website requests /// </summary> /// <param name="model"></param> /// <returns></returns> public bool CreateOrUpdate(WebSiteDto model) { var webSiteModel = new WebSite() { Id = model.Id, IsActive = model.IsActive, Name = model.Name, RequestInterval = model.RequestInterval, Url = model.Url, UserId = model.UserId, IsSetJob = false }; return(model.Id > 0 ? _repository.Update(webSiteModel).Result.Data : _repository.Create(webSiteModel).Result.Data); }