Ejemplo n.º 1
0
        public bool AddPetition(CreatePetitionDto createPetitionDto)
        {
            try
            {
                Petition newPetition = new Petition()
                {
                    Summary = createPetitionDto.Summary,
                    Statu   = (int)Statu.Gönderildi,
                    //MEVCUT LOGİN KULLANICI ÜZERİNE OLUŞTUR
                    UserId = createPetitionDto.UserID,
                    Date   = DateTime.Now
                };


                _petitionDal.Add(newPetition);


                Content newContent = new Content()
                {
                    PetitionID  = newPetition.PetitionID,
                    Description = createPetitionDto.FirstComment,
                    Date        = DateTime.Now,
                    UserId      = createPetitionDto.UserID,
                };

                bool result = _contentService.AddContent(newContent);
                MailHelper.SendPetitionCreated(newPetition, createPetitionDto.Email);

                return(result);
            }

            catch
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 public IResult Add(Petition petition)
 {
     _petitionDal.Add(petition);
     return(new Result(true, Messages.Added));
 }