public void Put(int id, [FromBody] TeamViewModel teamView) { if (id != teamView.id) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return; } if (!ModelState.IsValid) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return; } teamBll.SaveTeam(teamView.ToBaseModel()); }
public void Post([FromBody] TeamViewModel teamView) { if (!ModelState.IsValid) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return; } int teamId = teamBll.SaveTeam(teamView.ToBaseModel()); // move images from temp folder if (teamId > 0 && !string.IsNullOrWhiteSpace(teamView.image) && teamView.tempGuid.HasValue) { string tempGuid = teamView.tempGuid.ToString(); string storagePath = MainCfg.Images.Teams.Replace("{id}", teamId.ToString()); string tempPath = MainCfg.Images.Teams.Replace("{id}", tempGuid); LocalStorageHelper.MoveFromTempToStorage(storagePath, tempPath, tempGuid); } }