public async Task <Calls> AddCall(CallsVM model) { try { model.Description = Regex.Replace(model.Description, @"<[^>]+>| ", "").TrimStart(); Calls _call = new Calls() { CreatedDate = DateTime.Now, CreatedBy = 1, Types = model.Types, Subject = model.Subject, ResponsiblePerson = model.ResponsiblePerson, Priority = model.Priority, EventStartDate = model.EventStartDate, EventEndDate = model.EventEndDate, ReminderNotification = model.ReminderNotification, Completed = model.Completed, Description = model.Description, RepeatTask = model.RepeatTask, Interval = model.Interval, RepeatAfter = model.RepeatAfter, Untill = model.Untill, UntillDate = model.UntillDate, UntillCompile = model.UntillCompile, RemindUsing = model.RemindUsing, RemindTo = model.RemindTo, RepeatEvery = model.RepeatEvery, RepeatOnWeekDay = model.RepeatOnWeekDay, RepeatOnDay = model.RepeatOnDay, WillRepeat = model.WillRepeat, WillRepeatWeekDay = model.WillRepeatWeekDay, RepeatOnMonth = model.RepeatOnMonth, IsAllDay = model.IsAllDay, StartTimeZone = model.StartTimeZone, EndTimeZone = model.EndTimeZone, ShowReminder = model.ShowReminder, ReminderDate = model.ReminderDate, ReminderPerson = model.ReminderPerson }; await _context.Calls.InsertOneAsync(_call); return(_call); } catch (Exception ex) { throw ex; } }
public async Task <Calls> SetPriority(CallsVM model) { try { FilterDefinition <Calls> filter = Builders <Calls> .Filter.Eq("_id", ObjectId.Parse(model._id)); var result = _context.Calls.Find(filter).FirstOrDefaultAsync().Result; //await _context.Calls.InsertOneAsync(_call); return(result); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Update([FromBody] CallsVM model) { try { Calls Call = new Calls() { _id = ObjectId.Parse(model._id), Subject = model.Subject, ResponsiblePerson = model.ResponsiblePerson, Priority = model.Priority, Types = model.Types, EventStartDate = model.EventStartDate, EventEndDate = model.EventEndDate, ReminderNotification = model.ReminderNotification, Completed = model.Completed, Description = model.Description, RepeatTask = model.RepeatTask, Interval = model.Interval, RepeatAfter = model.RepeatAfter, Untill = model.Untill, UntillDate = model.UntillDate, UntillCompile = model.UntillCompile, RemindUsing = model.RemindUsing, RemindTo = model.RemindTo, RepeatEvery = model.RepeatEvery, RepeatOnWeekDay = model.RepeatOnWeekDay, RepeatOnDay = model.RepeatOnDay, WillRepeat = model.WillRepeat, WillRepeatWeekDay = model.WillRepeatWeekDay, RepeatOnMonth = model.RepeatOnMonth, IsAllDay = model.IsAllDay, StartTimeZone = model.StartTimeZone, EndTimeZone = model.EndTimeZone, ShowReminder = model.ShowReminder, ReminderDate = model.ReminderDate, ReminderPerson = model.ReminderPerson }; await _callRepository.UpdateCall(Call); return(new OkObjectResult(Call)); } catch (Exception ex) { } return(Ok()); }
public async Task <IActionResult> priority([FromBody] CallsVM Call) { return(Ok(await _callRepository.AddCall(Call))); }