Beispiel #1
0
        public override string Save_challenge(ChallengeDTO dto)
        {
            string msg = "";

            using (var context = new PHCEntities())
            {
                try
                {
                    Challenge ch = new Challenge();
                    ch.ChallengeName        = dto.ChallengeName;
                    ch.Description          = dto.Description;
                    ch.CatDescription       = dto.CatDescription;
                    ch.DogChallengeImage    = dto.dogchImg;
                    ch.CatChallengeImage    = dto.catchImg;
                    ch.BadgeID              = dto.BID;
                    ch.ChallengeCreatedDate = dto.ChcreatedDate;

                    context.AddToChallenges(ch);
                    context.SaveChanges();
                    msg = "success";
                }
                catch (Exception)
                {
                    msg = "fail";
                }
                return(msg);
            }
        }