Exemplo n.º 1
0
        public IHttpActionResult PostContectMaster(ContectMaster contectMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ContectMasters.Add(contectMaster);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ContectMasterExists(contectMaster.id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = contectMaster.id }, contectMaster));
        }
Exemplo n.º 2
0
        public IHttpActionResult PutContectMaster(int id, ContectMaster contectMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != contectMaster.id)
            {
                return(BadRequest());
            }

            db.Entry(contectMaster).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ContectMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public IHttpActionResult GetContectMaster(int id)
        {
            //ContectMaster contectMaster = db.ContectMasters.First(a => a.isPrimary == false);
            ContectMaster contectMaster = db.ContectMasters.First(a => a.id == id);

            //ContectMaster contectMaster = db.ContectMasters.Find(id);
            if (contectMaster == null)
            {
                return(NotFound());
            }

            return(Ok(contectMaster));
        }
Exemplo n.º 4
0
        public IHttpActionResult DeleteContectMaster(int id)
        {
            ContectMaster contectMaster = db.ContectMasters.Find(id);

            if (contectMaster == null)
            {
                return(NotFound());
            }

            db.ContectMasters.Remove(contectMaster);
            db.SaveChanges();

            return(Ok(contectMaster));
        }
Exemplo n.º 5
0
        public ActionResult YourDetails(string uid, UserDetails model)
        {
            // uid can be removed from argument.
            string unid = Request["uniqueId"];

            var     data     = from asd in _db.ResponceMasters where asd.uniqueId == unid select new { asd.aadharNo, asd.phoneNumber, asd.emailId };
            string  aadharno = null;
            decimal pno      = 0;
            string  email    = null;

            foreach (var item in data)
            {
                aadharno = item.aadharNo.ToString();
                pno      = Convert.ToDecimal(item.phoneNumber);
                email    = item.emailId;
            }

            int gender = 0;

            switch (model.gender)
            {
            case "Male":
                gender = 1;
                break;

            case "Female":
                gender = 2;
                break;

            case "Other":
                gender = 3;
                break;

            default:
                break;
            }

            int bloodgroup = 0;

            switch (model.BloodGroup)
            {
            case "A+":
                bloodgroup = 1;
                break;

            case "A-":
                bloodgroup = 2;
                break;

            case "B+":
                bloodgroup = 3;
                break;

            case "B-":
                bloodgroup = 4;
                break;

            case "AB+":
                bloodgroup = 5;
                break;

            case "AB-":
                bloodgroup = 6;
                break;

            case "O+":
                bloodgroup = 7;
                break;

            case "O-":
                bloodgroup = 8;
                break;

            default:
                break;
            }

            bool isgarduded = false;

            if (model.Orphan == "Yes")
            {
                isgarduded = true;
            }

            ErtoMaster _ertomaster = new ErtoMaster()
            {
                uniqueId   = unid,
                firstName  = model.FirstName,
                lastName   = model.LastName,
                gender     = gender,
                dob        = Convert.ToDateTime(model.DOB),
                bloodGroup = bloodgroup,
                isGaurded  = isgarduded
            };

            _db.ErtoMasters.Add(_ertomaster);
            _db.SaveChanges();
            int newId = _ertomaster.id;

            ContectMaster _contectmastermain = new ContectMaster()
            {
                id          = newId,
                phoneNumber = pno,
                emailId     = email,
                isPrimary   = true,
            };

            _db.ContectMasters.Add(_contectmastermain);
            _db.SaveChanges();

            if (model.SecondaryEmailId != null)
            {
                ContectMaster _contectmastersecondary = new ContectMaster()
                {
                    id          = newId,
                    phoneNumber = Convert.ToDecimal(model.SecondaryPhoneNumber),
                    emailId     = model.SecondaryEmailId,
                    isPrimary   = false,
                };
                _db.ContectMasters.Add(_contectmastersecondary);
                _db.SaveChanges();
            }

            string[] fathername = model.fatherName.Split(' ');

            GardianMaster _fatherrecord = new GardianMaster()
            {
                id          = newId,
                typeGardian = 1,
                gFirstName  = fathername[0],
                gMiddleName = fathername[1],
                gLastName   = fathername[2],
            };

            _db.GardianMasters.Add(_fatherrecord);
            _db.SaveChanges();

            string[]      mothername    = model.MotherName.Split(' ');
            GardianMaster _motherrecord = new GardianMaster()
            {
                id          = newId,
                typeGardian = 2,
                gFirstName  = mothername[0],
                gMiddleName = mothername[1],
                gLastName   = mothername[2],
            };

            _db.GardianMasters.Add(_motherrecord);
            _db.SaveChanges();

            if (model.Orphan == "Yes")
            {
                string[]      gardianname    = model.GardianName.Split(' ');
                GardianMaster _gardianrecord = new GardianMaster()
                {
                    id          = newId,
                    typeGardian = 3,
                    gFirstName  = gardianname[0],
                    gMiddleName = gardianname[1],
                    gLastName   = gardianname[2],
                };
                _db.GardianMasters.Add(_gardianrecord);
                _db.SaveChanges();
            }

            bool islivethere = true;

            if (model.LivingThere == "No")
            {
                islivethere = false;
            }

            string pma = null;
            string pna = null;
            string poa = null;

            string[] address = model.PermentAddress.Split(',');
            switch (address.Length)
            {
            case 3:
                pma = address[0];
                pna = address[1];
                poa = address[2];
                break;

            case 4:
                pma = address[0] + "," + address[1];
                pna = address[2];
                poa = address[3];
                break;

            case 5:
                pma = address[0] + "," + address[1];
                pna = address[2] + "," + address[3];
                poa = address[4];
                break;

            default:
                pma = address[0] + "," + address[1];
                pna = address[2] + "," + address[3];
                poa = address[4] + "," + address[5];
                break;
            }

            PermentAddressMaster _permentaddress = new PermentAddressMaster()
            {
                id                     = newId,
                mainAddress            = pma,
                nearByAddress          = pna,
                optionalAddress        = poa,
                city                   = model.PermentCity,
                pincode                = Convert.ToDecimal(model.PermentPincode),
                IsLiveInPermentAddress = islivethere,
            };

            _db.PermentAddressMasters.Add(_permentaddress);
            _db.SaveChanges();

            if (!islivethere)
            {
                string   oma             = null;
                string   ona             = null;
                string   ooa             = null;
                string[] optionaladdress = model.PresentAddress.Split(',');
                switch (address.Length)
                {
                case 3:
                    oma = address[0];
                    ona = address[1];
                    ooa = address[2];
                    break;

                case 4:
                    oma = address[0] + "," + address[1];
                    ona = address[2];
                    ooa = address[3];
                    break;

                case 5:
                    oma = address[0] + "," + address[1];
                    ona = address[2] + "," + address[3];
                    ooa = address[4];
                    break;

                default:
                    oma = address[0] + "," + address[1];
                    ona = address[2] + "," + address[3];
                    ooa = address[4] + "," + address[5];
                    break;
                }

                PersentAddressMaster _persentaddress = new PersentAddressMaster()
                {
                    id              = newId,
                    mainAddress     = oma,
                    nearByAddress   = ona,
                    optionalAddress = ooa,
                    city            = model.PresentCity,
                    pincode         = Convert.ToDecimal(model.PresentPincode),
                    duration        = Convert.ToInt32(model.Duration),
                };
                _db.PersentAddressMasters.Add(_persentaddress);
                _db.SaveChanges();
            }

            ExternalIdentityMaster _externalidentity = new ExternalIdentityMaster()
            {
                id          = newId,
                idenityType = 1,
                identityNo  = aadharno,
            };

            _db.ExternalIdentityMasters.Add(_externalidentity);
            _db.SaveChanges();

            return(RedirectToAction("SelectVanue", "LearningLicense", new { uid = unid }));
        }