Exemple #1
0
 public void PostDeleteMethod(int id)
 {
     using (var deprepo = new EmailRepository())
     {
         if (id != 0)
         {
             Email_services _email = deprepo.GetById(id);
             deprepo.Delete(_email);
         }
     }
 }
Exemple #2
0
        //public void updateemails(Email_services emails)
        //{

        //}
        #endregion
        public Email_serviceViewModel EmailDetails(int?id)
        {
            Email_serviceViewModel em = new Email_serviceViewModel();

            using (var emailrepo = new EmailRepository())
            {
                if (id.HasValue && id != 0)
                {
                    Email_services ema = emailrepo.GetById(id.Value);
                    em.To        = ema.To;
                    em.Cc        = ema.Cc;
                    em.Bcc       = ema.Bcc;
                    em.Subject   = ema.Subject;
                    em.Body      = ema.Body;
                    em.StaffName = ema.StaffName;
                }
                return(em);
            }
        }
        private HttpResponseMessage DeleteEmailRecord(HttpRequestMessage request, EmailDTO cqDto, int contactId, string key, int EmailId, int userId)
        {
            var ur   = new EmailRepository();
            var user = new Email();

            user = ur.GetById(contactId);


            var validationErrors = GetValidationErrors(ur, user, cqDto, EmailId, userId);

            if (validationErrors.Any())
            {
                return(ProcessValidationErrors(request, validationErrors, key));
            }

            ur.Delete(user);


            cqDto.Key = key;
            return(request.CreateResponse(HttpStatusCode.Accepted, cqDto));
        }
Exemple #4
0
        public Email_serviceViewModel GETdeleteMethod(int id)
        {
            Email_serviceViewModel ma = new Email_serviceViewModel();

            using (var mailrepo = new EmailRepository())
            {
                if (id != 0)
                {
                    Email_services _email = mailrepo.GetById(id);

                    ma.emailID   = _email.emailID;
                    ma.Cc        = _email.Cc;
                    ma.Body      = _email.Body;
                    ma.To        = _email.To;
                    ma.Bcc       = _email.Bcc;
                    ma.Subject   = _email.Subject;
                    ma.StaffName = _email.StaffName;
                }
                return(ma);
            }
        }
        private HttpResponseMessage ProcessExistingEmailRecord(HttpRequestMessage request, EmailDTO cqDto, int contactId, string key, int EmailId, int userId)
        {
            var ur = new EmailRepository();
            var user = new Email();
            user = ur.GetById(contactId);

            var validationErrors = GetValidationErrors(ur, user, cqDto, EmailId, userId);
            if (validationErrors.Any())
            {
                return ProcessValidationErrors(request, validationErrors, key);
            }

            ur.Save(user);

            cqDto.Key = key;
            return request.CreateResponse(HttpStatusCode.Accepted, cqDto);
        }