Пример #1
0
 public ActionResult Edit([Bind(Include = "CompanyId,CompanyName,VATNumber")] CompanyViewModel companyViewModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(companyViewModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(companyViewModel));
 }
 public ActionResult Create([Bind(Include = "ID,FK_DefContactReferenceTypeID,FK_ReferenceID,FullName,Email,Address,Position,Telephone,Telephone1,Mobile,Mobile1,Fax,FK_CreatorID,CreationDate,LastModifiedDate")] DefContact defContact)
 {
     if (ModelState.IsValid)
     {
         db.DefContacts.Add(defContact);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FK_DefContactReferenceTypeID = new SelectList(db.DefContactReferenceTypes, "ID", "ContactReferenceTypeName", defContact.FK_DefContactReferenceTypeID);
     return(View(defContact));
 }
        public ActionResult Create([Bind(Include = "ID,EmployeeName,Surname,BirthDate,IdentificationNumber,Address,Telephone")] HREmployee hREmployee)
        {
            if (ModelState.IsValid)
            {
                db.HREmployees.Add(hREmployee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(hREmployee));
        }
        public ActionResult Create([Bind(Include = "ID,ClientName,WebSite,Email,Address,Industry,FK_CreatorID,CreationDate,LastModifiedDate")] DefClient defClient)
        {
            if (ModelState.IsValid)
            {
                defClient.FK_CreatorID = User.Identity.GetUserId();
                DateTime nowTimestamp = DateTime.Now;
                defClient.CreationDate     = nowTimestamp;
                defClient.LastModifiedDate = nowTimestamp;

                db.DefClients.Add(defClient);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(defClient));
        }
 public ActionResult Edit([Bind(Include = "ID,FK_DefContactReferenceTypeID,FK_ReferenceID,FullName,Email,Address,Position,Telephone,Telephone1,Mobile,Mobile1,Fax,ContactReferenceTypeName")] DefContact defcontact)
 {
     if (ModelState.IsValid)
     {
         db.Entry(defcontact).State = EntityState.Modified;
         defcontact.FK_CreatorID    = GetCurrUserID();
         DateTime nowTimestamp = DateTime.Now;
         defcontact.LastModifiedDate = nowTimestamp;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(defcontact));
 }
        public ActionResult Create([Bind(Include = "ID,FK_DefCompanyID,LeadSerial,LeadName,LeadDate,NewOfficeSize,NewOfficeAddress,ExpectedBudget,FK_DefClientID,FK_DefBrokerID,FK_BrokerDefContactID,FK_DefModuleStatusID,FK_LedLeadSourceID,FK_AssignedByHREmployeeID,FK_AssignedToHREmployeeID,LeadAssignedDate,Notes,FK_CreatorID,CreationDate,LastModifiedDate")] LedLead ledLead)
        {
            if (ModelState.IsValid)
            {
                ledLead.FK_CreatorID = User.Identity.GetUserId();
                DateTime nowTimestamp = DateTime.Now;
                ledLead.CreationDate     = nowTimestamp;
                ledLead.LastModifiedDate = nowTimestamp;

                db.LedLeads.Add(ledLead);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.FK_DefBrokerID            = new SelectList(db.DefBrokers, "ID", "BrokerName", ledLead.FK_DefBrokerID);
            ViewBag.FK_DefClientID            = new SelectList(db.DefClients, "ID", "ClientName", ledLead.FK_DefClientID);
            ViewBag.FK_DefCompanyID           = new SelectList(db.DefCompanies, "ID", "CompanyName", ledLead.FK_DefCompanyID);
            ViewBag.FK_BrokerDefContactID     = new SelectList(db.DefContacts, "ID", "FullName", ledLead.FK_BrokerDefContactID);
            ViewBag.FK_DefModuleStatusID      = new SelectList(db.DefModuleStatus, "ID", "ModuleStatusName", ledLead.FK_DefModuleStatusID);
            ViewBag.FK_AssignedByHREmployeeID = new SelectList(db.HREmployees, "ID", "EmployeeName", ledLead.FK_AssignedByHREmployeeID);
            ViewBag.FK_AssignedToHREmployeeID = new SelectList(db.HREmployees, "ID", "EmployeeName", ledLead.FK_AssignedToHREmployeeID);
            ViewBag.FK_LedLeadSourceID        = new SelectList(db.LedLeadSources, "ID", "LeadSourceName", ledLead.FK_LedLeadSourceID);
            return(View(ledLead));
        }
        public ActionResult Create([Bind(Include = "ID,BrokerName,WebSite,Email,Address,Industry,FK_CreatorID,CreationDate,LastModifiedDate")] DefBroker defBroker)
        {
            if (ModelState.IsValid)
            {
                defBroker.FK_CreatorID = User.Identity.GetUserId();
                DateTime nowTimestamp = DateTime.Now;
                defBroker.CreationDate     = nowTimestamp;
                defBroker.LastModifiedDate = nowTimestamp;

                db.DefBrokers.Add(defBroker);
                db.SaveChanges();

                String message = HttpContext.User.Identity.Name + " has created a new Broker";
                //System.Diagnostics.Debug.WriteLine(loggedUsername);

                //call the function with the new object to be created
                createNotificationObject(message, notificationList);
                //createEmailObject("*****@*****.**", "Trend Notification!", message);

                return(RedirectToAction("Index"));
            }

            return(View(defBroker));
        }
Пример #8
0
 public virtual void Save()
 {
     DataContext.SaveChanges();
 }