public async Task <IHttpActionResult> Post(user user) { if (ModelState.IsValid) { try { user modiUser = await Repo.GetEntity(user.Id); if (modiUser != null)// for update { Repo.Update(user); } else { Repo.Add(user);// for new user UOW.Save(); } return(Ok()); } catch { return(BadRequest()); } } else { return(BadRequest()); } }
//in case create new task // or update task by manager to assign it to group public async Task <IHttpActionResult> Post(request req) { if (ModelState.IsValid) { try { request modireq = await Repo.GetEntity(req.Id); if (modireq != null)//for update { Repo.Update(req); } else { Repo.Add(new request() { requestTitle = req.requestTitle, requestBody = req.requestBody }); //for new UOW.Save(); } return(Ok(new request())); } catch (Exception e) { return(BadRequest()); } } else { return(BadRequest()); } }