Пример #1
0
        public ActionResult Create(Contact contact, FormCollection collection)
        {
            try
            {
                HttpPostedFileBase file = Request.Files["ImageData"];
                contact.ConImage = new byte[] { };
                if (file != null && file.ContentLength > 0)
                {
                    using (var binaryReader = new BinaryReader(file.InputStream))
                    {
                        contact.ConImage = binaryReader.ReadBytes(file.ContentLength);
                    }
                }

                res = API_Contact.SaveContact(contact);

                if (res.Status)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    res.Data = contact;
                    return(View(res));
                }
            }
            catch
            {
                res.Data = contact;
                return(View(res));
            }
        }
Пример #2
0
 public ActionResult Edit(int Id)
 {
     res = API_Contact.GetContactDetails(Id);
     if (res.Data != null && res.Data.LstImages != null)
     {
         res.Data.ConImage = res.Data.LstImages.ToArray();
     }
     return(View(res));
 }
Пример #3
0
 public ActionResult ContactsGridPartial()
 {
     res.DataList = API_Contact.GetAllContacts().DataList;
     if (Session[SessionNames.ContactLayout] != null)
     {
         API_RefOptions.SaveGridLayout(new GridLayout("Contact", 0, (string)Session[SessionNames.ContactLayout]));
     }
     else
     {
         Session[SessionNames.ContactLayout] = API_RefOptions.GetSavedGridLayout("Contact", 0).ToString();
     }
     return(PartialView("_ContactsGridPartial", res));
 }
Пример #4
0
        public ActionResult Edit(int Id, Contact contact, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
                if (Id > 0 && ModelState.IsValid)
                {
                    contact.ContactID = Id;
                    contact.ConImage  = new byte[] { };
                    HttpPostedFileBase file = Request.Files["ImageData"];
                    if (file != null && file.ContentLength > 0)
                    {
                        using (var binaryReader = new BinaryReader(file.InputStream))
                        {
                            contact.ConImage = binaryReader.ReadBytes(file.ContentLength);
                        }
                    }
                    else
                    {
                        if (res.Data != null && res.Data.LstImages != null)
                        {
                            contact.ConImage = res.Data.LstImages.ToArray();
                        }
                    }

                    res = API_Contact.SaveContact(contact);

                    if (res.Status)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        res.Data = contact;
                        return(View(res));
                    }
                }
                else
                {
                    res.Data = contact;
                    return(View(res));
                }
            }
            catch
            {
                res.Data = contact;
                return(View(res));
            }
        }
Пример #5
0
        public ActionResult OrganizationContactFormPartial(int ContactID = 0)
        {
            var data = API_Contact.GetContactDetails(ContactID).Data;

            res.Data.OrgContact = new OrgContact();
            if (data != null)
            {
                res.Data.OrgContact.BusinessPhone = data.ConBusinessPhone;
                res.Data.OrgContact.ContactID     = data.ContactID;
                res.Data.OrgContact.Email         = data.ConEmailAddress;
                res.Data.OrgContact.Email2        = data.ConEmailAddress2;
                res.Data.OrgContact.Fax           = data.ConFaxNumber;
                res.Data.OrgContact.FirstName     = data.ConFirstName;
                res.Data.OrgContact.HomePhone     = data.ConHomePhone;
                res.Data.OrgContact.LastName      = data.ConLastName;
                res.Data.OrgContact.MiddleName    = data.ConMiddleName;
                res.Data.OrgContact.MobilePhone   = data.ConMobilePhone;
                res.Data.OrgContact.Title         = data.ConTitle;
            }
            return(Json(res.Data.OrgContact, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
 public ActionResult Delete(int Id)
 {
     res = API_Contact.RemoveContact(Id);
     return(RedirectToAction("Index"));
     //return Json(res, JsonRequestBehavior.AllowGet);
 }
Пример #7
0
 public ActionResult Create()
 {
     res = new Response <Contact>();
     res = API_Contact.GetContactDetails(0);
     return(View(res));
 }
Пример #8
0
 public ActionResult ContactsComboBoxPartial()
 {
     return(PartialView("_ContactsComboBoxPartial", API_Contact.GetAllContacts().DataList));
 }