Example #1
0
        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");
        }
Example #2
0
        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");
        }
Example #3
0
        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"));
            }
        }
Example #4
0
        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"));
            }
        }
Example #5
0
        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."));
            }
        }
Example #6
0
        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."));
            }
        }