コード例 #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");
        }
コード例 #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");
        }
コード例 #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"));
            }
        }
コード例 #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"));
            }
        }
コード例 #5
0
        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");
        }
コード例 #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."));
            }
        }
コード例 #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."));
            }
        }
コード例 #8
0
 public BaseController(ControllersServices services)
 {
     _services = services;
 }
コード例 #9
0
 public HomeController(ControllersServices services) : base(services)
 {
 }