Ejemplo n.º 1
0
 public static StudentGroup ToDataModel(StudentGroupInputModel model)
 {
     return(new StudentGroup
     {
         UserId = model.UserId,
         GroupId = model.GroupId,
         Rating = model.Rating
     });
 }
Ejemplo n.º 2
0
        public ActionResult UpdateUserRating([FromBody] StudentGroupInputModel model)
        {
            if (model == null || model.UserId < 1 || model.GroupId < 1)
            {
                return(BadRequest("Object not found"));
            }
            StudentGroup modelSG = StudentGroupMapper.ToDataModel(model);

            if (modelSG.Rating > -1 && modelSG.Rating < 11)
            {
                groupStorage.UpdateUserRating(modelSG);
                return(Ok());
            }
            else
            {
                return(BadRequest("Введите рейтинг от 0 до 10"));
            }
        }