Beispiel #1
0
        public async Task<IActionResult> Post([FromBody]BlastRoom nBlastWorkItem)
        {
            if (nBlastWorkItem != null)
            {
                nBlastWorkItem.CreateDate = DateTime.Now;
                nBlastWorkItem.Creator = nBlastWorkItem.Creator ?? "Someone";

                if (nBlastWorkItem.PaintTeam != null)
                    nBlastWorkItem.PaintTeam = null;

                return new JsonResult(await this.repository.AddAsync(nBlastWorkItem), this.DefaultJsonSettings);
            }
            return NotFound(new { Error = "Not found blast room data !!!" });
        }
Beispiel #2
0
        public async Task<IActionResult> PutByNumber(int key, [FromBody]BlastRoom uBlastWorkItem)
        {
            var Message = "Blast room not been found.";

            if (uBlastWorkItem != null)
            {
                // set modified
                uBlastWorkItem.ModifyDate = DateTime.Now;
                uBlastWorkItem.Modifyer = uBlastWorkItem.Modifyer ?? "Someone";

                if (uBlastWorkItem.PaintTeam != null)
                    uBlastWorkItem.PaintTeam = null;

                return new JsonResult(await this.repository.UpdateAsync(uBlastWorkItem, key), this.DefaultJsonSettings);
            }

            return NotFound(new { Error = Message });
        }