示例#1
0
        public async Task <IActionResult> GetByID(string id)
        {
            long.TryParse(id.FromBase64(), out long ID);
            var spklu  = new SKPLURepo(_db);
            var result = await spklu.GetByID(ID);

            if (result.SKPLUID == 0)
            {
                return(NotFound($"Data Not Found"));
            }
            return(Ok(result));
        }
示例#2
0
        public async Task <IActionResult> Delete(string id)
        {
            long.TryParse(id.FromBase64(), out long ID);
            var repo  = new SKPLURepo(_db);
            var model = await repo.GetByID(ID);

            if (model.SKPLUID == 0)
            {
                return(NotFound($"Data Not Found"));
            }
            model.ModifyBy = 1; model.ModifyDate = DateTime.Now;
            if (ModelState.IsValid)
            {
                var result = await repo.Delete(model);

                if (result.Success)
                {
                    return(Ok(result));
                }
                return(BadRequest(result));
            }
            return(BadRequest());
        }