public async Task <string> ChangeSymptoms([FromBody] List <Symptom> editList) { if (editList == null || editList.Count == 0) { return(ControllersServices.ErrorMessage("List is empty")); } await _context.AddOrEditSymptomsRange(editList); return("true"); }
public async Task <string> DeleteSymptoms([FromBody] List <int> deleteList) { if (deleteList == null || deleteList.Count == 0) { return(ControllersServices.ErrorMessage("List is empty")); } await _context.DeleteSymptomsAsync(deleteList); return("true"); }
public async Task <string> AddNewVisitor([FromQuery] int doc, [FromBody] Visitation visitor) { var result = await _context.AddNewVisitorAsync(doc, visitor); if (result) { return(JsonConvert.SerializeObject(new { result }, ControllersServices.JsonSettings)); } else { return(ControllersServices.ErrorMessage("Trouble with adding new Docktor")); } }
public async Task <string> AddNewSeparation([FromBody] Separation separation) { var result = await _context.AddNewSeparationAsync(separation); if (result) { return(JsonConvert.SerializeObject(new { result }, ControllersServices.JsonSettings)); } else { return(ControllersServices.ErrorMessage("Trouble with adding new Separation")); } }
public async Task <string> Import([FromQuery] int type) { var context = await ControllersServices.GetJsonFromBodyRequestAsync(Request.Body); var isParsed = TryDeserialize(context, type); if (!isParsed) { return("false"); } return("true"); }
public async Task <string> GetComments([FromQuery] int postid) { if (!User.Identity.IsAuthenticated) { return(ControllersServices.ErrorMessage("auth")); } var result = await _context.GetCommentAsync(postid); if (result != null) { return(JsonConvert.SerializeObject(new { CommentsList = result })); } else { return(ControllersServices.ErrorMessage("Can't add new comment, sorry.")); } }
public async Task <string> AddComment([FromQuery] int postid) { if (!User.Identity.IsAuthenticated) { return(ControllersServices.ErrorMessage("auth")); } var context = await ControllersServices.GetJsonFromBodyRequestAsync(Request.Body); var result = await _context.AddNewCommentAsync(postid, User.Identity.Name, context); if (result != null) { return(JsonConvert.SerializeObject(result)); } else { return(ControllersServices.ErrorMessage("Can't add new comment, sorry.")); } }
public BaseController(ControllersServices services) { _services = services; }
public HomeController(ControllersServices services) : base(services) { }