public async Task <IActionResult> PutByNumber(int key, [FromBody] BlastWorkItem uBlastWorkItem) { var Message = "Require painting not been found."; if (uBlastWorkItem != null) { // set modified uBlastWorkItem.ModifyDate = DateTime.Now; uBlastWorkItem.Modifyer = uBlastWorkItem.Modifyer ?? "Someone"; if (uBlastWorkItem.SurfaceTypeInt != null) { uBlastWorkItem.SurfaceTypeInt = null; } if (uBlastWorkItem.SurfaceTypeExt != null) { uBlastWorkItem.SurfaceTypeExt = null; } if (uBlastWorkItem.StandradTimeExt != null) { uBlastWorkItem.StandradTimeExt = null; } if (uBlastWorkItem.StandradTimeInt != null) { uBlastWorkItem.StandradTimeInt = null; } return(new JsonResult(await this.repository.UpdateAsync(uBlastWorkItem, key), this.DefaultJsonSettings)); } return(NotFound(new { Error = Message })); }
public async Task <IActionResult> Post([FromBody] BlastWorkItem nBlastWorkItem) { if (nBlastWorkItem != null) { nBlastWorkItem.CreateDate = DateTime.Now; nBlastWorkItem.Creator = nBlastWorkItem.Creator ?? "Someone"; if (nBlastWorkItem.SurfaceTypeInt != null) { nBlastWorkItem.SurfaceTypeInt = null; } if (nBlastWorkItem.SurfaceTypeExt != null) { nBlastWorkItem.SurfaceTypeExt = null; } if (nBlastWorkItem.StandradTimeExt != null) { nBlastWorkItem.StandradTimeExt = null; } if (nBlastWorkItem.StandradTimeInt != null) { nBlastWorkItem.StandradTimeInt = null; } return(new JsonResult(await this.repository.AddAsync(nBlastWorkItem), this.DefaultJsonSettings)); } return(NotFound(new { Error = "Not found BlastWork data !!!" })); }