Beispiel #1
0
        public string AddOtp(string phonenum, string otp)
        {
            var str = "could not add otp";

            try
            {
                var findobj = (from c in context.Otp
                               where c.Phoneno == phonenum
                               select c).FirstOrDefault();
                if (findobj == null)
                {
                    var obj = new Otp();
                    obj.Otpstring   = otp;
                    obj.Phoneno     = phonenum;
                    obj.CreatedDate = DateTime.Now;
                    context.Otp.Add(obj);
                    context.SaveChanges();
                    str = "sucessfully added otp";
                }
                else
                {
                    findobj.Otpstring   = otp;
                    findobj.CreatedDate = DateTime.Now;
                    using (var newContext = new StuffyCareContext())
                    {
                        newContext.Otp.Update(findobj);
                        newContext.SaveChanges();
                        str = "OTP updated sucessfully";
                    }
                }
            }
            catch (Exception e)
            {
                str = e.Message;
                throw e;
            }
            return(str);
        }
Beispiel #2
0
        public string UpdateCart(Cart cart)
        {
            string status = "could not update try again";

            try
            {
                Cart carti = (from c in context.Cart
                              where c.Userid == cart.Userid && c.Itemid == cart.Itemid
                              select c).FirstOrDefault();
                carti.Quantity = cart.Quantity;
                using (var newContext = new StuffyCareContext())
                {
                    newContext.Cart.Update(carti);
                    newContext.SaveChanges();
                    status = "updated sucessfuly";
                }
            }
            catch (Exception e)
            {
                status = "exception occured in Dal";
                throw e;
            }
            return(status);
        }
Beispiel #3
0
        public string UpdateServices(Vendorservices services)
        {
            string status = "could not update try again";

            try
            {
                Vendorservices carti = (from c in context.Vendorservices
                                        where c.Vendorid == services.Vendorid && c.Name == services.Name
                                        select c).FirstOrDefault();
                carti.Price = services.Price;
                using (var newContext = new StuffyCareContext())
                {
                    newContext.Vendorservices.Update(carti);
                    newContext.SaveChanges();
                    status = "updated sucessfuly";
                }
            }
            catch (Exception e)
            {
                status = "exception occured in Dal";
                throw e;
            }
            return(status);
        }
Beispiel #4
0
 public UserDAOImpl()
 {
     context = new StuffyCareContext();
 }
Beispiel #5
0
 public VendorDAOImpl()
 {
     context = new StuffyCareContext();
 }