public void ExcluirEvento(int idEvento) { if (idEvento != 0) { _agendaService.Delete(idEvento); } }
public IHttpActionResult ExcluiAgenda(string id) { var retorno = _agendaService.Delete(id); if (!retorno.Status) { return(new InvalidListMessageResult(retorno.Message)); } return(Ok(retorno)); }
public IActionResult DeleteAgenda(int id) { Agenda agenda = _agendaService.Delete(id); if (agenda == null) { return(NotFound()); } return(Ok(agenda)); }
public IActionResult CancelarAgendamento(int id, string data) { try { _service.Delete(id, data); return(new NoContentResult()); } catch (ArgumentException ex) { return(NotFound(ex)); } catch (Exception ex) { return(BadRequest(ex)); } }
public async Task <IActionResult> Delete(Guid id) { try { var response = await _service.Delete(id); if (!response.IsSuccessful) { return(BadRequest(response)); } return(Ok(response)); } catch { return(StatusCode(500, "Internal Server Error.")); } }
public HttpResponseMessage AgendaAjax() { IEnumerable <KeyValuePair <string, string> > queryString = Request.GetQueryNameValuePairs(); AgendaParams agendaParams = KTUtils.GetObjectFromRequest <AgendaParams>(queryString); if (agendaParams.CM.ToUpper() == "MICSAVE") { Schedule schedule = KTUtils.GetObjectFromRequest <Schedule>(queryString); schedule.discriminator = "P"; schedule.startTime = schedule.startMillis.TimeOfDay.TotalMilliseconds.ObjToInt(); schedule.duration = schedule.endMillis.Subtract(schedule.startMillis).TotalMilliseconds; IScheduleService scheduleService = new ScheduleService(); Schedule resultS = scheduleService.Insert(schedule); // 保存 string id = agendaService.Maxid().id.ToString(); Agenda agenda = KTUtils.GetObjectFromRequest <Agenda>(queryString); agenda.id = id; agenda.typeid = agenda.type.ObjToInt(); agenda.authorid = this.UserID.ToString(); agenda.creator = this.UserInfo.UserName; agenda.lastModifier = this.UserInfo.UserName; agenda.creationDate = DateTime.Now; agenda.lastModified = DateTime.Now; agenda.icalId = "TW_" + id; agenda.exceptions = string.Empty; agenda.scheduleid = resultS.scheduleid; Agenda result = agendaService.Insert(agenda); // 写入关联人员 List <AgendaTarget> listTar = new List <AgendaTarget>(); string[] ids = (agendaParams.WG_IDS ?? "").Split(','); for (int i = 0; i < ids.Length; i++) { listTar.Add(new AgendaTarget { agendaid = result.id, resid = ids[i] }); } if (listTar.Count > 0) { IAgendaTargetService agendaTargetService = new AgendaTargetService(); agendaTargetService.Insert(listTar); } // 查询 string returnstr = GetAgendaList(agendaParams); return(new JsonResult(returnstr)); } else if (agendaParams.CM.ToUpper() == "GETEVENTS") { // 查询 agendaParams.userID = this.UserID.ToString(); // 时间范围计算 string returnstr = GetAgendaList(agendaParams); return(new JsonResult(returnstr)); } else if (agendaParams.CM.ToUpper() == "DELEV") { // 删除 agendaService.Delete(agendaParams); string returnstr = GetAgendaList(agendaParams); return(new JsonResult(returnstr)); } else { var obj = new { ok = true, events = "" }; string returnstr = Newtonsoft.Json.JsonConvert.SerializeObject(obj); return(new JsonResult(returnstr)); } }
public IActionResult Delete(int id) { return(Ok( _agendaService.Delete(id) )); }
// DELETE: api/Agenda/5 public void Delete(int id) { _agendaService.Delete(id); }