Esempio n. 1
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");
        }
Esempio n. 2
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");
        }
Esempio n. 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"));
            }
        }
Esempio n. 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"));
            }
        }
        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");
        }
Esempio n. 6
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."));
            }
        }
Esempio n. 7
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."));
            }
        }
Esempio n. 8
0
 public BaseController(ControllersServices services)
 {
     _services = services;
 }
Esempio n. 9
0
 public HomeController(ControllersServices services) : base(services)
 {
 }