public async Task <IActionResult> DeleteCompany(int id) { var company = await _repo.GetCompany(id); _repo.Delete(company); if (await _repo.SaveAll()) { return(NoContent()); } throw new Exception("Coś poszło nie tak podczas kasowania firmy"); }
public async Task <ActionResult <bool> > Delete(int timesheetId) { var sessionData = _sessionService.GetSession(HttpContext); if (sessionData == null) { return(Unauthorized()); } return(Ok(await _timesheetRepository.Delete(sessionData.UserId, timesheetId))); }
public async Task <IActionResult> DeleteUser(int id) { var user = _repo.GetUser(id); _repo.Delete(user); if (await _repo.SaveAll()) { return(CreatedAtAction("GetUsers", new {})); } throw new Exception("Cos poszlo nie tak podczas usuwania uzytkownika"); }
public IActionResult Update([FromRoute] string name, [FromBody] JsonPatchDocument <Timesheet> patchDocument) { if (!repostitory.Exists(name)) { return(NotFound()); } var timesheet = repostitory.GetByName(name); patchDocument.ApplyTo(timesheet); if (name != timesheet.Name) // Name has changed, check for conflicts { if (repostitory.Exists(timesheet.Name)) // new name conflicts with exisitng timesheet { return(this.ConflictWithRoute("GetByName", new { name = timesheet.Name })); } repostitory.Delete(name); } repostitory.Save(timesheet); return(Ok(timesheet)); }
public void DeleteTimesheet(int id) { _repository.Delete(id); }
public bool Delete(string id) { _timesheetRepository.Delete(id); return(true); }