Ejemplo n.º 1
0
        public async Task <IActionResult> Update(string employerid, [FromForm] UpdateEmployerViewModel model)
        {
            if (employerid != User.FindFirst(ClaimTypes.NameIdentifier).Value)
            {
                return(Unauthorized());
            }

            var employerFromDB = await _userManager.FindByIdAsync(employerid);

            //Update Profile

            if (employerFromDB.ProfileImageUrl != null)
            {
                await _cloudStorage.DeleteImage(employerFromDB.ProfileImageUrl);
            }
            var addedFileNameUrl = await _cloudStorage.UploadAsync(model.ProfileImage);

            employerFromDB.ProfileImageUrl = addedFileNameUrl;


            var result = await _userManager.UpdateAsync(employerFromDB);

            var updatedEmployer = await _userManager.FindByIdAsync(employerid);

            var employerToReturn = _mapper.Map <UserViewModel>(updatedEmployer);

            if (result.Succeeded)
            {
                return(Ok(new
                {
                    result = result,
                    user = employerToReturn
                }));
            }

            return(BadRequest(result));
        }
Ejemplo n.º 2
0
        public void UpdateEmployer(UpdateEmployerViewModel model)
        {
            try
            {
                if (model != null && model.EmployerRowID > 0)
                {
                    MasterEmployer entity = new MasterEmployer();
                    entity.EmployerRowID      = model.EmployerRowID;
                    entity.CompanyName        = model.CompanyName;
                    entity.CountryRowID       = model.CountryRowID;
                    entity.StateRowID         = model.StateRowID;
                    entity.DistrictRowID      = model.DistrictRowID;
                    entity.AdditionalComments = model.AdditionalComments;
                    entity.AdditionalCost     = model.AdditionalCost;
                    entity.AdditionalCosting  = model.AdditionalCosting;
                    entity.ConcernPersonName  = model.ConcernPersonName;
                    //entity.DDFavourOf = model.DDFavourOf;
                    entity.CompanyLegalStatus = model.CompanyLegalStatus;
                    entity.CINNumber          = model.CINNumber;
                    entity.RegisteredOnMCA    = model.RegisteredOnMCA;
                    entity.PaidUpCapital      = model.PaidUpCapital;
                    entity.MandatoryDocument  = model.MandatoryDocument;
                    entity.PVInitiated        = model.PVInitiated;
                    entity.PVInitAtAddress    = model.PVInitAtAddress;
                    //entity.MCAPVRegProof = model.MCAPVRegProof;
                    entity.OtherDocumentNo    = model.OtherDocumentNo;
                    entity.DesigConcernPerson = model.DesigConcernPerson;
                    entity.LocationRowID      = model.LocationRowID;
                    //entity.CityRowID = model.CityRowID;
                    //entity.VerificationProcessTAT = model.VerificationProcessTAT;
                    entity.Website            = model.Website;
                    entity.CompanyStatus      = model.CompanyStatus;
                    entity.CompanyAddress     = model.CompanyAddress;
                    entity.SpecialInstruction = model.SpecialInstruction;
                    entity.ModeOfInitiation   = model.ModeOfInitiation;
                    entity.ModeOfPayment      = model.ModeOfPayment;
                    entity.OfficialEmailId    = model.OfficialEmailId;
                    entity.OfficialLandlineNo = model.OfficialLandlineNo;
                    entity.MobileNo           = model.MobileNo;
                    entity.Other1             = model.Other1;
                    entity.Other2             = model.Other2;
                    entity.Other3             = model.Other3;
                    entity.Other4             = model.Other4;
                    entity.Other5             = model.Other5;
                    //entity.Status = model.Status;
                    entity.FavourOf              = model.FavourOf;
                    entity.OtherDocumentDetail   = model.OtherDocumentDetail;
                    entity.COtherStatus          = model.COtherStatus;
                    entity.COtherLegalStatus     = model.COtherLegalStatus;
                    entity.OtherInitiation       = model.OtherInitiation;
                    entity.PayableAT             = model.PayableAT;
                    entity.AccountNumber         = model.AccountNumber;
                    entity.IFSCCode              = model.IFSCCode;
                    entity.CompanySnapshot       = model.Snapshot;
                    entity.VerificationTATLevel1 = model.VerificationTATLevel1;
                    entity.VerificationTATLevel2 = model.VerificationTATLevel2;
                    entity.MCARegProof           = model.MCARegProof;
                    entity.PVInitAtAddressProof  = model.PVInitAtAddressProof;
                    entity.OtherDocumentAdded    = model.OtherDocumentAdded;
                    entity.OtherDocProof         = model.OtherDocProof;
                    entity.ModifiedDate          = model.ModifiedDate;

                    db.Entry(entity).State = EntityState.Modified;
                }
                else
                {
                    throw new Exception("Employer could not be blank!");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        public UpdateEmployerViewModel GetEmployerForUpdateById(short EmployerRowID)
        {
            try
            {
                UpdateEmployerViewModel model = new UpdateEmployerViewModel();
                var entity = db.MasterEmployers.Find(EmployerRowID);

                if (entity != null)
                {
                    model.EmployerRowID      = entity.EmployerRowID;
                    model.CompanyName        = entity.CompanyName;
                    model.CountryRowID       = entity.CountryRowID;
                    model.StateRowID         = entity.StateRowID;
                    model.DistrictRowID      = entity.DistrictRowID;
                    model.AdditionalComments = entity.AdditionalComments;
                    model.AdditionalCost     = entity.AdditionalCost;
                    model.AdditionalCosting  = entity.AdditionalCosting;
                    model.ConcernPersonName  = entity.ConcernPersonName;
                    //model.DDFavourOf       = entity.DDFavourOf;
                    model.CompanyLegalStatus = entity.CompanyLegalStatus;
                    model.CINNumber          = entity.CINNumber;
                    model.RegisteredOnMCA    = entity.RegisteredOnMCA;
                    model.PaidUpCapital      = entity.PaidUpCapital;
                    model.MandatoryDocument  = entity.MandatoryDocument;
                    model.PVInitiated        = entity.PVInitiated;
                    model.PVInitAtAddress    = entity.PVInitAtAddress;
                    // model.MCAPVRegProof   = entity.MCAPVRegProof;
                    model.OtherDocumentNo    = entity.OtherDocumentNo;
                    model.DesigConcernPerson = entity.DesigConcernPerson;
                    model.LocationRowID      = entity.LocationRowID;
                    // model.CityRowID       = entity.CityRowID;
                    // model.VerificationProcessTAT = entity.VerificationProcessTAT;
                    model.Website               = entity.Website;
                    model.CompanyStatus         = entity.CompanyStatus;
                    model.CompanyAddress        = entity.CompanyAddress;
                    model.SpecialInstruction    = entity.SpecialInstruction;
                    model.ModeOfInitiation      = entity.ModeOfInitiation;
                    model.ModeOfPayment         = entity.ModeOfPayment;
                    model.OfficialEmailId       = entity.OfficialEmailId;
                    model.OfficialLandlineNo    = entity.OfficialLandlineNo;
                    model.MobileNo              = entity.MobileNo;
                    model.Other1                = entity.Other1;
                    model.Other2                = entity.Other2;
                    model.Other3                = entity.Other3;
                    model.Other4                = entity.Other4;
                    model.Other5                = entity.Other5;
                    model.Status                = entity.Status;
                    model.FavourOf              = entity.FavourOf;
                    model.OtherDocumentDetail   = entity.OtherDocumentDetail;
                    model.COtherStatus          = entity.COtherStatus;
                    model.COtherLegalStatus     = entity.COtherLegalStatus;
                    model.OtherInitiation       = entity.OtherInitiation;
                    model.PayableAT             = entity.PayableAT;
                    model.AccountNumber         = entity.AccountNumber;
                    model.IFSCCode              = entity.IFSCCode;
                    model.Snapshot              = entity.CompanySnapshot;
                    model.VerificationTATLevel1 = entity.VerificationTATLevel1;
                    model.VerificationTATLevel2 = entity.VerificationTATLevel2;
                    model.MCARegProof           = entity.MCARegProof;
                    model.PVInitAtAddressProof  = entity.PVInitAtAddressProof;
                    model.OtherDocumentAdded    = entity.OtherDocumentAdded;
                    model.OtherDocProof         = entity.OtherDocProof;
                }
                else
                {
                    throw new Exception("Invalid Id!");
                }
                return(model);
            }
            catch (Exception)
            {
                throw;
            }
        }