예제 #1
0
        public async Task <ActionResult> UpdateAvatarModal(UpdateAvatarModel model)
        {
            var userId = User.Identity.GetUserId <int>();

            model.UserName   = User.Identity.Name;
            model.AvatarPath = Server.MapPath("~/Content/Images/Avatar");
            var result = await ImageWriter.CreateAvatarImage(model);

            if (result.Success)
            {
                await AwardWriter.AddUserAward(new AddUserAwardModel
                {
                    UserId = userId,
                    Type   = Enums.AwardType.Avatar
                });
            }
            return(Json(result));
        }