public VendorsCatering UpdatesCatering(VendorsCatering vendorsCatering, long id,long vid)
 {
     var GetVendor = _dbContext.VendorsCatering.SingleOrDefault(m => m.VendorMasterId == id && m.Id == vid);
     vendorsCatering.Id = GetVendor.Id;
     vendorsCatering.VendorMasterId = GetVendor.VendorMasterId;
     _dbContext.Entry(GetVendor).CurrentValues.SetValues(vendorsCatering);
     _dbContext.SaveChanges();
     return vendorsCatering;
 }
 public VendorsCatering UpdateCatering(VendorsCatering vendorsCatering, Vendormaster vendorMaster, long masterid, long vid)
 {
     //vendorsCatering.Status = "InActive";
     vendorsCatering.UpdatedDate = updateddate;
     //vendorMaster.Status = "InActive";
     vendorMaster.UpdatedDate = updateddate;
     //vendorMaster.ServicType = "Venue";
     vendorsCatering = vendorCateringRepository.UpdatesCatering(vendorsCatering, masterid, vid);
     return(vendorsCatering);
 }
        public VendorsCatering AddNewCatering(VendorsCatering vendorsCatering, Vendormaster vendorMaster)
        {
            DateTime updateddate = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);

            vendorsCatering.Status         = "Active";
            vendorsCatering.UpdatedDate    = updateddate;
            vendorsCatering.VendorMasterId = vendorMaster.Id;
            vendorsCatering = vendorCateringRespository.AddCatering(vendorsCatering);
            return(vendorsCatering);
        }
        public VendorsCatering UpdatesCatering(VendorsCatering vendorsCatering, Vendormaster vendorMaster, long masterid, long vid)
        {
            DateTime updateddate = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);

            vendorsCatering.Status      = "Active";
            vendorsCatering.UpdatedDate = updateddate;
            vendorMaster.Status         = "Active";
            vendorMaster.UpdatedDate    = updateddate;
            vendorMaster.ServicType     = "Catering";
            vendorMaster    = vendorMasterRepository.UpdateVendorMaster(vendorMaster, masterid);
            vendorsCatering = vendorCateringRespository.UpdatesCatering(vendorsCatering, masterid, vid);
            return(vendorsCatering);
        }
        //updating vendor Service Record
        public long UpdateVendorService(string id, string vid, string type)
        {
            long masterid = 0;

            if (type == "Venue")
            {
                VendorVenue vendorVenue = vendorVenueRepository.GetVendorVenue(long.Parse(id), long.Parse(vid));
                vendorVenue.VenueType = "";
                vendorVenue           = vendorVenueRepository.UpdateVenue(vendorVenue, long.Parse(id), long.Parse(vid));
                masterid = vendorVenue.Id;
            }
            if (type == "Catering")
            {
                VendorsCatering vendorsCatering = vendorCateringRepository.GetVendorsCatering(long.Parse(id), long.Parse(vid));
                vendorsCatering.CuisineType = "";
                vendorsCatering             = vendorCateringRepository.UpdatesCatering(vendorsCatering, long.Parse(id), long.Parse(vid));
                masterid = vendorsCatering.Id;
            }
            if (type == "Decorator")
            {
                VendorsDecorator vendorsDecorator = vendorsDecoratorRepository.GetVendorDecorator(long.Parse(id), long.Parse(vid));
                vendorsDecorator.DecorationType = "";
                vendorsDecorator = vendorsDecoratorRepository.UpdateDecorator(vendorsDecorator, long.Parse(id), long.Parse(vid));
                masterid         = vendorsDecorator.Id;
            }
            if (type == "Photography")
            {
                VendorsPhotography vendorsPhotography = vendorsPhotographyRepository.GetVendorsPhotography(long.Parse(id), long.Parse(vid));
                vendorsPhotography.PhotographyType = "";
                vendorsPhotography = vendorsPhotographyRepository.UpdatesPhotography(vendorsPhotography, long.Parse(id), long.Parse(vid));
                masterid           = vendorsPhotography.Id;
            }
            if (type == "Event")
            {
                VendorsEventOrganiser vendorsEventOrganiser = vendorEventOrganiserRepository.GetVendorEventOrganiser(long.Parse(id), long.Parse(vid));
                vendorsEventOrganiser.type = "";
                vendorsEventOrganiser      = vendorEventOrganiserRepository.UpdateEventOrganiser(vendorsEventOrganiser, long.Parse(id), long.Parse(vid));
                masterid = vendorsEventOrganiser.Id;
            }
            if (type == "Other")
            {
                VendorsOther vendorsOther = vendorOthersRepository.GetVendorOthers(long.Parse(id), long.Parse(vid));
                vendorsOther.type = "";
                vendorsOther      = vendorOthersRepository.UpdateOthers(vendorsOther, long.Parse(id), long.Parse(vid));
                masterid          = vendorsOther.Id;
            }
            return(masterid);
        }
        // Discount% updation in every service
        public long DiscountUpdate(string type, string id, string vid, string discount)
        {
            long masterid = 0;

            if (type == "Venue")
            {
                VendorVenue vendorVenue = vendorVenueRepository.GetVendorVenue(long.Parse(id), long.Parse(vid));
                vendorVenue.discount = discount;
                vendorVenue          = vendorVenueRepository.UpdateVenue(vendorVenue, long.Parse(id), long.Parse(vid));
                masterid             = vendorVenue.Id;
            }
            if (type == "Catering")
            {
                VendorsCatering vendorsCatering = vendorCateringRepository.GetVendorsCatering(long.Parse(id), long.Parse(vid));
                vendorsCatering.discount = discount;
                vendorsCatering          = vendorCateringRepository.UpdatesCatering(vendorsCatering, long.Parse(id), long.Parse(vid));
                masterid = vendorsCatering.Id;
            }
            if (type == "Decorator")
            {
                VendorsDecorator vendorsDecorator = vendorsDecoratorRepository.GetVendorDecorator(long.Parse(id), long.Parse(vid));
                vendorsDecorator.discount = discount;
                vendorsDecorator          = vendorsDecoratorRepository.UpdateDecorator(vendorsDecorator, long.Parse(id), long.Parse(vid));
                masterid = vendorsDecorator.Id;
            }
            if (type == "Photography")
            {
                VendorsPhotography vendorsPhotography = vendorsPhotographyRepository.GetVendorsPhotography(long.Parse(id), long.Parse(vid));
                vendorsPhotography.discount = discount;
                vendorsPhotography          = vendorsPhotographyRepository.UpdatesPhotography(vendorsPhotography, long.Parse(id), long.Parse(vid));
                masterid = vendorsPhotography.Id;
            }
            if (type == "Event")
            {
                VendorsEventOrganiser vendorsEventOrganiser = vendorEventOrganiserRepository.GetVendorEventOrganiser(long.Parse(id), long.Parse(vid));
                vendorsEventOrganiser.discount = discount;
                vendorsEventOrganiser          = vendorEventOrganiserRepository.UpdateEventOrganiser(vendorsEventOrganiser, long.Parse(id), long.Parse(vid));
                masterid = vendorsEventOrganiser.Id;
            }
            if (type == "Other")
            {
                VendorsOther vendorsOther = vendorOthersRepository.GetVendorOthers(long.Parse(id), long.Parse(vid));
                vendorsOther.discount = discount;
                vendorsOther          = vendorOthersRepository.UpdateOthers(vendorsOther, long.Parse(id), long.Parse(vid));
                masterid = vendorsOther.Id;
            }
            return(masterid);
        }
        public VendorsCatering AddCatering(VendorsCatering vendorCatering, Vendormaster vendorMaster)
        {
            DateTime updateddate = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);

            vendorCatering.Status      = "Active";
            vendorCatering.UpdatedDate = updateddate;
            vendorMaster.Status        = "Active";
            vendorMaster.UpdatedDate   = updateddate;
            vendorMaster.ServicType    = "Catering";
            vendorMaster = vendorMasterRepository.AddVendorMaster(vendorMaster);
            vendorCatering.VendorMasterId = vendorMaster.Id;
            vendorCatering                = vendorCateringRespository.AddCatering(vendorCatering);
            userLogin.UserName            = vendorMaster.EmailId;
            userLogin.Password            = randomPassword.GenerateString();
            userLogin.UserType            = "Vendor";
            userLogin.UpdatedBy           = 2;
            userLogin.RegDate             = updateddate;
            userLogin.UpdatedDate         = updateddate;
            userLogin.Status              = "Active";
            userLogin                     = userLoginRepository.AddVendorUserLogin(userLogin);
            userDetail.UserLoginId        = userLogin.UserLoginId;
            userDetail.FirstName          = vendorMaster.BusinessName;
            userDetail.UserPhone          = vendorMaster.ContactNumber;
            userDetail.Url                = vendorMaster.Url;
            userDetail.Address            = vendorMaster.Address;
            userDetail.City               = vendorMaster.City;
            userDetail.State              = vendorMaster.State;
            userDetail.ZipCode            = vendorMaster.ZipCode;
            userDetail.Status             = "Active";
            userDetail.UpdatedBy          = ValidUserUtility.ValidUser();
            userDetail.UpdatedDate        = updateddate;
            userDetail.AlternativeEmailID = vendorMaster.EmailId;
            userDetail.Landmark           = vendorMaster.Landmark;
            userDetail                    = userDetailsRepository.AddUserDetails(userDetail);
            if (vendorMaster.Id != 0 && vendorCatering.Id != 0 && userLogin.UserLoginId != 0 && userDetail.UserDetailId != 0)
            {
                return(vendorCatering);
            }
            else
            {
                vendorCatering.Id = 0;
                return(vendorCatering);
            }
        }
        //Catering Area

        public VendorsCatering AddVendorCatering(VendorsCatering vendorsCatering)
        {
            vendorsCatering.UpdatedDate = updateddate;
            return(vendorVenueSignUpRepository.AddVendorCatering(vendorsCatering));
        }
 public VendorsCatering AddCatering(VendorsCatering vendorsCatering)
 {
     _dbContext.VendorsCatering.Add(vendorsCatering);
     _dbContext.SaveChanges();
     return vendorsCatering;
 }