Пример #1
0
        public ContactListResponse GetContactList()
        {
            var resp = new ContactListResponse();

            resp.Contacts = new Contacts();

            using (var uow = new ChitFundDbContext(dbConnection))
            {
                var customers = uow.Contacts.GetAllContacts();
                foreach (var c in customers)
                {
                    c.PrimaryType = 1;
                    resp.Contacts.Add(c);
                }
            }
            return(resp);

            //mocq data
            //var resp = new CustomerListResponse();
            //resp.Customers = new Customers();
            //for (int i = 0; i < 5; i++)
            //{
            //    Customer c1 = new Customer();
            //    c1.CustomerId = i;
            //    c1.Name = "mahesh";
            //    c1.Email = "*****@*****.**";
            //    c1.Phone = "3432324";
            //    c1.PrimaryType = 1;

            //    resp.Customers.Add(c1);
            //}
            //return resp;
        }
Пример #2
0
 public void Post_UpdateContacts([FromBody] List <Contact> mContactList)
 {
     using (var uow = new ChitFundDbContext(dbConnection))
     {
         foreach (Contact c in mContactList)
         {
             uow.Contacts.Save(c);
         }
     }
 }
Пример #3
0
 public void Post_DeleteContact(List <int> ids)
 {
     using (var uow = new ChitFundDbContext(dbConnection))
     {
         if (ids.Count > 0)
         {
             ids.ForEach(delegate(int id)
             {
                 uow.Contacts.Delete(id);
             });
         }
     }
 }
Пример #4
0
        public AddContactsResponse Post_AddContacts([FromBody] List <Contact> mContactList)
        {
            var contactIdList = new List <int>();

            using (var uow = new ChitFundDbContext(dbConnection))
            {
                foreach (Contact c in mContactList)
                {
                    uow.Contacts.Save(c);
                    contactIdList.Add(c.ContactID);
                }
            }

            var resp = new AddContactsResponse();

            resp.ContactIdList = contactIdList;
            return(resp);
        }