public void Delete(Lead lead)
        {
            var thelead = _db.Leads.FirstOrDefault(c => c.Id == lead.Id);

            _db.Leads.Remove(thelead);
            _db.SaveChanges();
        }
        public Lead Create(Lead lead)
        {
            lead.DateCreated = DateTime.Now;
            lead.DateUpdated = DateTime.Now;
            lead.LeadStatus = LeadStatus.New;

            _db.Leads.Add(lead);
            _db.SaveChanges();

            return lead;
        }
        public Lead Update(Lead lead)
        {
            var thelead = _db.Leads.FirstOrDefault(c => c.Id ==lead.Id);

            if (thelead != null)
            {
                thelead.DateUpdated = DateTime.Now;
                thelead.LeadStatus = lead.LeadStatus;

                _db.SaveChanges();
            }

            return thelead;
        }
 private void Send(Lead model)
 {
     var api = new MandrillApi("IRWMe1g1dCTrG6uOZEy7gQ");
     var message = new MandrillMessage();
     message.Subject = "New lead";
     message.FromEmail = "*****@*****.**";
     message.AddTo("*****@*****.**");
     message.ReplyTo = "*****@*****.**";
     //supports merge var content as string
     message.AddGlobalMergeVars("Name", model.Name);
     message.AddGlobalMergeVars("LeadStatus", model.LeadStatus.ToString());
     message.AddGlobalMergeVars("DateCreated", model.DateCreated.ToShortDateString());
     message.AddGlobalMergeVars("DateUpdated", model.DateUpdated.ToShortDateString());
     message.AddGlobalMergeVars("EMAIL", model.Email);
     message.AddGlobalMergeVars("Skype", model.Skype);
     message.AddGlobalMergeVars("Phone", model.Phone);
     message.AddGlobalMergeVars("Company", model.Company);
     message.AddGlobalMergeVars("Skype", model.Skype);
     message.AddGlobalMergeVars("ProjectDescription", model.ProjectDescription);
     message.AddGlobalMergeVars("ProjectStart", model.ProjectStart);
     message.AddGlobalMergeVars("ProjectDeadline", model.ProjectDeadline);
     //template should be created
     var result = api.Messages.SendTemplate(message, "jarboo-new-lead");
 }