Beispiel #1
0
 public virtual async Task <ActionResult <TEntity> > PutAsync(string id, [FromBody] TEntity entity)
 {
     if (typeof(IEntityBusiness).IsAssignableFrom(typeof(TEntity)))
     {
         return(await _business.UpdateEntityAsync(id, entity));
     }
     else
     {
         var entityId = entity?.GetEntityId()?.ToString();
         if (!entityId.Equals(id))
         {
             return(NotFound($"Id:{id} != entityId:{entityId}"));
         }
         return(await _business.UpdateEntityAsync(EntityHelper <TEntity> .GetTyped(id), entity));
     }
 }