示例#1
0
        public IHttpActionResult resendGsmCode()
        {
            int user_id = Users.GetUserId(User);

            Users user = db.users.Where(u => u.id == user_id).FirstOrDefault();

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

            if (String.IsNullOrEmpty(user.gsm))
            {
                ExceptionThrow.Throw("Lütfen geçerli bir gsm numarası kullanın.", HttpStatusCode.BadRequest);
            }

            if (user.gsm_last_update != null)
            {
                TimeSpan diff = DateTime.Now - Convert.ToDateTime(user.gsm_last_update);
                if (diff.TotalMinutes <= 4)
                {
                    ExceptionThrow.Throw("Yeni aktivasyon kodu için 4 dakika beklemeniz gerekmektedir.", HttpStatusCode.Forbidden);
                }
            }

            //generate activation code
            Random rnd      = new Random();
            string gsm_code = rnd.Next(9999, 999999).ToString();

            try
            {
                user.gsm_activation_code = gsm_code;
                user.gsm_last_update     = DateTime.Now;
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                ExceptionThrow.Throw(ex);
            }

            //Send Gsm Activation Code
            NetGsm.Send(user.gsm, "menkule.com.tr uyeliginiz ile ilgili onay kodunuz: " + user.gsm_activation_code);

            return(Ok());
        }
示例#2
0
        public IHttpActionResult externalConfirm([FromBody] _ExternalConfirm externalConfirmData)
        {
            int user_id = Users.GetUserId(User);

            if (externalConfirmData.password != externalConfirmData.reply)
            {
                ExceptionThrow.Throw("Şifre tekrarı hatalı.", HttpStatusCode.BadRequest);
            }

            if (db.users.Any(u => u.gsm == externalConfirmData.gsm))
            {
                ExceptionThrow.Throw("gsm no kullanılmaktadır.", HttpStatusCode.BadRequest);
            }

            Users user = db.users.Where(u => u.id == user_id && u.is_external_confirm == false).FirstOrDefault();

            if (user == null)
            {
                ExceptionThrow.Throw("Zaten şifre güncellenmiş", HttpStatusCode.Forbidden);
            }

            user.gsm                 = externalConfirmData.gsm;
            user.updated_date        = DateTime.Now;
            user.password            = Bcrypt.hash(externalConfirmData.password);
            user.is_external_confirm = true;

            try
            {
                db.SaveChanges();

                //Send Gsm Activation Code
                NetGsm.Send(externalConfirmData.gsm, "menkule.com.tr uyeliginiz ile ilgili onay kodunuz: " + user.gsm_activation_code);
            }
            catch (Exception ex)
            {
                ExceptionThrow.Throw(ex);
            }
            return(Ok());
        }
        public IHttpActionResult cancel(int id)
        {
            int user_id = Users.GetUserId(User);

            Rezervations rezervation = db.rezervations.Find(id);

            if (rezervation == null)
            {
                return(NotFound());
            }
            if (rezervation.is_cancel)
            {
                ExceptionThrow.Throw("Rezervasyon daha önce iptal edilmiş.", HttpStatusCode.Forbidden);
            }

            RezervationAdverts advert = db.rezervation_adverts.Where(ra => ra.advert_id == rezervation.advert_id).FirstOrDefault();

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

            bool is_cancel = rezervation.is_cancel;

            rezervation.state        = false;
            rezervation.is_cancel    = true;
            rezervation.updated_date = DateTime.Now;


            if (advert.user_id == user_id)
            {
                Users user = db.users.Find(rezervation.user_id);
                if (user == null)
                {
                    return(NotFound());
                }
                db.SaveChanges();

                // Add notify
                Notifications notify = new Notifications();
                notify.add(user.id, "#" + rezervation.id + " nolu " + rezervation.days + " günlük rezervasyon talebi iptal edildi!", rezervation.id);

                // Send sms
                NetGsm.Send(user.gsm, "#" + rezervation.id + " nolu " + "(" + rezervation.days + " gün - " + rezervation.total_price + " TL) rezervasyonunuz iptal edildi. - Menkule.com.tr");

                // Send email
                Mailgun.Send("cancel", new Dictionary <string, object>()
                {
                    { "fullname", System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(user.name) + " " + System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(user.lastname) }, { "rezervation_id", rezervation.id }, { "checkin", Convert.ToDateTime(rezervation.checkin).ToShortDateString() }, { "checkout", Convert.ToDateTime(rezervation.checkout).ToShortDateString() }, { "days", rezervation.days }, { "price", rezervation.total_price + " TL." }
                }, user.email, "Rezervasyon talebi iptal edildi.");
            }


            // Delete unavaiable dates
            db.advert_unavaiable_dates.RemoveRange(db.advert_unavaiable_dates.Where(uad => uad.advert_id == rezervation.advert_id && uad.rezervation_id == id));

            if (user_id == rezervation.user_id)
            {
                DateTime lastCanceleableDate = rezervation.checkin.AddDays(-advert.cancel_time);
                DateTime EndDate             = DateTime.Now;
                int      dateDiff            = Convert.ToInt32(lastCanceleableDate.Subtract(EndDate).TotalDays) + 1;
                if (!(dateDiff <= 0 || is_cancel ? false : true))
                {
                    ExceptionThrow.Throw("Bu rezervasyon iptal süresi dışındadır.", HttpStatusCode.Forbidden);
                }
                db.SaveChanges();

                Users advert_owner = db.users.Find(rezervation.owner);
                if (advert_owner != null)
                {
                    // Send sms
                    NetGsm.Send(advert_owner.gsm, "#" + rezervation.id + " nolu " + "(" + rezervation.days + " gün - " + rezervation.total_price + " TL) rezervasyon talebi iptal edildi. - Menkule.com.tr");

                    // Add Notify
                    Notifications notify = new Notifications();
                    notify.add(advert_owner.id, "#" + rezervation.id + " nolu " + rezervation.days + " günlük rezervasyon talebi iptal edildi!", rezervation.id);

                    // Send email
                    Mailgun.Send("cancel", new Dictionary <string, object>()
                    {
                        { "fullname", System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(advert_owner.name) + " " + System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(advert_owner.lastname) }, { "rezervation_id", rezervation.id }, { "checkin", Convert.ToDateTime(rezervation.checkin).ToShortDateString() }, { "checkout", Convert.ToDateTime(rezervation.checkout).ToShortDateString() }, { "days", rezervation.days }, { "price", rezervation.total_price + " TL." }
                    }, advert_owner.email, "Rezervasyon talebi iptal edildi.");
                }
            }

            return(Ok());
        }
        public object forceApprove([FromBody] _ExistRezervation rezervations, int id)
        {
            int user_id = Users.GetUserId(User);

            // get exist rezervation id
            List <int> rezervations_id = new List <int>();

            rezervations.rezervations.ToList().ForEach(r =>
            {
                if (!db.rezervations.Any(rr => rr.owner == user_id))
                {
                    ExceptionThrow.Throw("Yetkisiz işlem gerçekleştirildi!", HttpStatusCode.Forbidden);
                }
                rezervations_id.Add(r.id);
            });

            // rezervation validation
            Rezervations rezervation = db.rezervations.Find(id);

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

            // rezervation validation
            if (rezervation.updated_date != null)
            {
                ExceptionThrow.Throw("Yetkisiz işlem gerçekleştirildi!", HttpStatusCode.Forbidden);
            }

            // rezervation advert validation
            RezervationAdverts advert = db.rezervation_adverts.Where(ra => ra.advert_id == rezervation.advert_id).FirstOrDefault();

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

            // rezervation owner validation
            if (advert.user_id != user_id)
            {
                ExceptionThrow.Throw("Yetkisiz işlem gerçekleştirildi!", HttpStatusCode.Forbidden);
            }

            // rezervation user validation
            Users user = db.users.Find(rezervation.user_id);

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

            rezervation.state        = true;
            rezervation.is_cancel    = false;
            rezervation.updated_date = DateTime.Now;

            // available date validation
            var dateList = new List <DateTime>();

            for (DateTime date = rezervation.checkin; date.Date < rezervation.checkout.Date; date = date.AddDays(1))
            {
                dateList.Add(date);
            }

            // set unavaiable date
            dateList.ForEach(date =>
            {
                AdvertUnavailableDate advertUnavaiableDate = new AdvertUnavailableDate
                {
                    advert_id      = rezervation.advert_id,
                    day            = date.Day,
                    month          = date.Month,
                    year           = date.Year,
                    fulldate       = date,
                    created_date   = DateTime.Now,
                    rezervation_id = rezervation.id
                };
                db.advert_unavaiable_dates.Add(advertUnavaiableDate);
            });


            db.rezervations.Where(r => r.owner == user_id && rezervations_id.Contains(r.id)).ToList().ForEach(rez =>
            {
                rez.state        = false;
                rez.is_cancel    = true;
                rez.updated_date = DateTime.Now;
            });

            db.SaveChanges();

            rezervations.rezervations.ForEach(r =>
            {
                Rezervations rez_ = db.rezervations.Where(r_ => r_.id == r.id && r_.state == false & r_.is_cancel == true).FirstOrDefault();
                if (rez_ != null)
                {
                    Users user_ = db.users.Where(u => u.id == rez_.user_id).FirstOrDefault();
                    if (user_ != null)
                    {
                        // Add notify
                        Notifications notify_ = new Notifications();
                        notify_.add(user_.id, "#" + rez_.id + " nolu " + rez_.days + " günlük rezervasyon talebi iptal edildi!", rez_.id);

                        // Send sms
                        NetGsm.Send(user_.gsm, "#" + rez_.id + " nolu " + "(" + rez_.days + " gün - " + rez_.total_price + " TL) rezervasyonunuz iptal edildi. - Menkule.com.tr");

                        // Send email
                        Mailgun.Send("cancel", new Dictionary <string, object>()
                        {
                            { "fullname", System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(user_.name) + " " + System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(user_.lastname) }, { "rezervation_id", rez_.id }, { "checkin", Convert.ToDateTime(rez_.checkin).ToShortDateString() }, { "checkout", Convert.ToDateTime(rez_.checkout).ToShortDateString() }, { "days", rez_.days }, { "price", rez_.total_price + " TL." }
                        }, user_.email, "Rezervasyon talebi iptal edildi.");
                    }
                }
            });

            // send sms
            NetGsm.Send(user.gsm, "#" + rezervation.id + " nolu " + "(" + rezervation.days + " gün - " + rezervation.total_price + " TL) rezervasyonunuz onaylandı. - Menkule.com.tr");

            // send notifications
            Notifications notify = new Notifications();

            notify.add(user.id, "#" + rezervation.id + " nolu rezervasyon talebiniz onaylandı.", rezervation.id);

            // Send email
            Mailgun.Send("approve", new Dictionary <string, object>()
            {
                { "fullname", System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(user.name) + " " + System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(user.lastname) }, { "rezervation_id", rezervation.id }, { "checkin", Convert.ToDateTime(rezervation.checkin).ToShortDateString() }, { "checkout", Convert.ToDateTime(rezervation.checkout).ToShortDateString() }, { "days", rezervation.days }, { "price", rezervation.total_price + " TL." }
            }, user.email, "Rezervasyon talebi onaylandı.");

            return(Ok());
        }
        public object approve(int id)
        {
            int user_id = Users.GetUserId(User);

            Rezervations rezervation = db.rezervations.Find(id);

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


            if (rezervation.updated_date != null)
            {
                ExceptionThrow.Throw("Yetkisiz işlem gerçekleştirildi!", HttpStatusCode.Forbidden);
            }

            RezervationAdverts advert = db.rezervation_adverts.Where(ra => ra.advert_id == rezervation.advert_id).FirstOrDefault();

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

            if (advert.user_id != user_id)
            {
                ExceptionThrow.Throw("Yetkisiz işlem gerçekleştirildi!", HttpStatusCode.Forbidden);
            }

            Users user = db.users.Find(rezervation.user_id);

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

            // exist rezervation validations
            DateTime checkoutDate       = rezervation.checkout.AddDays(-1);
            var      exist_rezervations = db.rezervations.Where(r => ((r.checkin >= rezervation.checkin && r.checkin <= checkoutDate) || (r.checkin <= rezervation.checkin && r.checkout <= checkoutDate)) && r.advert_id == advert.advert_id && r.id != id && r.state == false && r.is_cancel == false && r.checkout > rezervation.checkin).ToList();

            if (exist_rezervations.Count > 0)
            {
                ExceptionThrow.Throw(exist_rezervations, HttpStatusCode.NotImplemented);
            }

            rezervation.state        = true;
            rezervation.is_cancel    = false;
            rezervation.updated_date = DateTime.Now;

            // available date validation
            var dateList = new List <DateTime>();

            for (DateTime date = rezervation.checkin; date.Date < rezervation.checkout.Date; date = date.AddDays(1))
            {
                dateList.Add(date);
            }

            // set unavaiable date
            dateList.ForEach(date =>
            {
                AdvertUnavailableDate advertUnavaiableDate = new AdvertUnavailableDate
                {
                    advert_id      = rezervation.advert_id,
                    day            = date.Day,
                    month          = date.Month,
                    year           = date.Year,
                    fulldate       = date,
                    created_date   = DateTime.Now,
                    rezervation_id = rezervation.id
                };
                db.advert_unavaiable_dates.Add(advertUnavaiableDate);
            });

            db.SaveChanges();

            // send sms
            NetGsm.Send(user.gsm, "#" + rezervation.id + " nolu " + "(" + rezervation.days + " gün - " + rezervation.total_price + " TL) rezervasyonunuz onaylandı. - Menkule.com.tr");

            // send notifications
            Notifications notify = new Notifications();

            notify.add(user.id, "#" + rezervation.id + " nolu rezervasyon talebiniz onaylandı.", rezervation.id);

            // Send email
            Mailgun.Send("approve", new Dictionary <string, object>()
            {
                { "fullname", System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(user.name) + " " + System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(user.lastname) }, { "rezervation_id", rezervation.id }, { "checkin", Convert.ToDateTime(rezervation.checkin).ToShortDateString() }, { "checkout", Convert.ToDateTime(rezervation.checkout).ToShortDateString() }, { "days", rezervation.days }, { "price", rezervation.total_price + " TL." }
            }, user.email, "Rezervasyon talebi onaylandı.");

            return(Ok());
        }
        public IHttpActionResult add([FromBody] _Rezervation _rezervation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            // get user
            int   user_id = Users.GetUserId(User);
            Users user    = db.users.Where(u => u.id == user_id && u.state == true).FirstOrDefault();

            if (user == null)
            {
                ExceptionThrow.Throw("Lütfen hesabınızı doğrulayın.", HttpStatusCode.Forbidden);
            }

            // existence
            Advert advert = db.advert.Where(a => a.state == true && a.id == _rezervation.advert_id).FirstOrDefault();

            if (advert == null)
            {
                return(NotFound());
            }
            if (db.rezervations.Any(rez => rez.user_id == user_id && rez.advert_id == _rezervation.advert_id && rez.checkin == _rezervation.checkin && rez.checkout == _rezervation.checkout))
            {
                ExceptionThrow.Throw("Zaten aynı tarih için bir rezervasyon talebiniz bulunmakta.", HttpStatusCode.Forbidden);
            }

            if (user_id == advert.user_id)
            {
                ExceptionThrow.Throw("Lütfen farklı bir hesap ile deneyin.", HttpStatusCode.Forbidden);
            }

            // visitor validation
            AdvertProperties properties = db.advert_properties.Where(ap => ap.advert_id == advert.id).FirstOrDefault();

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

            if (properties.visitor < _rezervation.visitors.Count)
            {
                ExceptionThrow.Throw("Bu ilan için en fazla. " + properties.visitor + " misafir kabul edilebilmektedir.", HttpStatusCode.Forbidden);
            }

            // get owner
            Users owner = db.users.Where(u => u.id == advert.user_id).FirstOrDefault();

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

            // rezervation dates list
            var RezervationDates = new List <DateTime>();

            for (DateTime date = _rezervation.checkin; date.Date < _rezervation.checkout.Date; date = date.AddDays(1))
            {
                RezervationDates.Add(date);
            }

            // available dates validation
            List <AdvertAvailableDate> avaiableDates = db.advert_avaiable_dates.Where(aad => aad.advert_id == _rezervation.advert_id).ToList();

            if (avaiableDates.Count > 0)
            {
                RezervationDates.ForEach(rd =>
                {
                    if (avaiableDates.Find(a => a.fulldate == rd) == null)
                    {
                        ExceptionThrow.Throw("İlan belirtilen tarih için müsait değil.", HttpStatusCode.Forbidden);
                    }
                });
            }

            // unavailable dates validation
            if (db.advert_unavaiable_dates.Where(i => i.advert_id == _rezervation.advert_id && RezervationDates.Contains(i.fulldate)).Count() > 0)
            {
                ExceptionThrow.Throw("İlan belirtilen tarih için müsait değil.", HttpStatusCode.Forbidden);
            }

            // min layover date validation
            if ((_rezervation.checkout - _rezervation.checkin).TotalDays < advert.min_layover)
            {
                ExceptionThrow.Throw("Bu ilan için en az " + advert.min_layover + " günlük rezervasyon oluşturulabilir.", HttpStatusCode.Forbidden);
            }

            // create rezervation
            Rezervations rezervation = new Rezervations
            {
                advert_id    = _rezervation.advert_id,
                checkin      = _rezervation.checkin,
                checkout     = _rezervation.checkout,
                created_date = DateTime.Now,
                gsm          = user.gsm,
                name         = user.name,
                lastname     = user.lastname,
                visitor      = _rezervation.visitors.Count,
                user_id      = user.id,
                day_price    = advert.price,
                owner        = advert.user_id,
                note         = _rezervation.note
            };

            db.rezervations.Add(rezervation);
            db.SaveChanges();

            // create rezervations advert
            RezervationAdverts rezervation_advert = new RezervationAdverts
            {
                adress         = advert.adress,
                advert_id      = advert.id,
                cancel_time    = advert.cancel_time,
                city_id        = advert.city_id,
                town_id        = advert.town_id,
                title          = advert.title,
                description    = advert.description,
                entry_time     = advert.entry_time,
                exit_time      = advert.exit_time,
                latitude       = advert.latitude,
                longitude      = advert.longitude,
                rezervation_id = rezervation.id,
                created_date   = advert.created_date,
                user_id        = advert.user_id,
                advert_type_id = advert.advert_type_id
            };

            db.rezervation_adverts.Add(rezervation_advert);

            // create visitors
            _rezervation.visitors.ToList().ForEach(v =>
            {
                RezervationVisitors visitor = new RezervationVisitors
                {
                    created_date   = DateTime.Now,
                    fullname       = v.fullname,
                    gender         = v.gender,
                    rezervation_id = rezervation.id,
                    tc             = v.tc
                };
                db.rezervation_visitors.Add(visitor);
            });

            db.SaveChanges();

            // send notifications
            Notifications notify = new Notifications();

            notify.add(advert.user_id, "#" + advert.id + " nolu ilanınız için " + rezervation.days + " günlük rezervasyon talebi!", rezervation.id);

            // send sms
            NetGsm.Send(owner.gsm, "#" + advert.id + " nolu ilaniniz icin toplam " + rezervation.days + " günlük (" + rezervation.total_price + " TL) rezervasyon talebi oluşturuldu. - Menkule.com.tr");

            //send mail
            Mailgun.Send("rezervation", new Dictionary <string, object>()
            {
                { "fullname", System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(user.name) + " " + System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(user.lastname) }, { "advert_id", advert.id }, { "checkin", Convert.ToDateTime(rezervation.checkin).ToShortDateString() }, { "checkout", Convert.ToDateTime(rezervation.checkout).ToShortDateString() }, { "days", rezervation.days }, { "price", rezervation.total_price + " TL." }
            }, owner.email, "Yeni rezervasyon talebi");

            return(Ok());
        }
示例#7
0
        public IHttpActionResult add([FromBody] Users user)
        {
            //validation
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (db.users.Any(u => u.email == user.email))
            {
                ExceptionThrow.Throw("e-posta adresi kullanılmaktadır.", HttpStatusCode.BadRequest);
            }
            if (db.users.Any(u => u.gsm == user.gsm))
            {
                ExceptionThrow.Throw("gsm no kullanılmaktadır.", HttpStatusCode.BadRequest);
            }

            //generate activation code
            Random rnd        = new Random();
            string gsm_code   = rnd.Next(9999, 999999).ToString();
            string email_code = rnd.Next(9999, 999999).ToString();

            //set password
            bool   no_password = user.password == null || user.password.Trim() == "";
            string password    = no_password ? Users.generatePassword(5, 3) : user.password;

            //create user
            Users userData = new Users
            {
                name                  = user.name,
                lastname              = user.lastname,
                email                 = user.email,
                gender                = user.gender,
                gsm                   = user.gsm,
                description           = user.description,
                password              = Bcrypt.hash(password),
                source                = "web",
                email_activation_code = email_code,
                gsm_activation_code   = gsm_code
            };


            if (user.identity_no != null)
            {
                userData.identity_no = user.identity_no;
            }

            //insert user
            db.users.Add(userData);

            try
            {
                db.SaveChanges();

                //If password is random generated
                if (no_password)
                {
                    NetGsm.Send(user.gsm, "Menkule.com.tr üyelik şifreniz " + password + " Şifrenizi değiştirmeyi unutmayınız.");
                }
            }
            catch (Exception ex)
            {
                ExceptionThrow.Throw(ex);
            }

            //Send Gsm Activation Code
            NetGsm.Send(user.gsm, "menkule.com.tr uyeliginiz ile ilgili onay kodunuz: " + gsm_code);

            //Send Email Notification
            Mailgun.Send("register", new Dictionary <string, object>()
            {
                { "fullname", user.name + " " + user.lastname }
            }, user.email, "Üyeliğiniz için teşekkürler");

            object token = no_password ? Users.LoginOnBackDoor(user.email, password) : null;


            return(Ok(new
            {
                name = user.name,
                lastname = user.lastname,
                email = user.email,
                gsm = user.gsm,
                gender = user.gender,
                photo = "",
                ownershiping = user.ownershiping,
                state = user.state,
                email_state = user.email_state,
                gsm_state = user.gsm_state,
                created_date = user.created_date,
                token = token
            }));
        }
示例#8
0
        public IHttpActionResult update([FromBody] Users user)
        {
            int   user_id = Users.GetUserId(User);
            Users dbUser  = db.users.Find(user_id);

            if (dbUser == null)
            {
                return(NotFound());
            }
            if (dbUser.email != user.email && db.users.Any(u => u.email == user.email))
            {
                ExceptionThrow.Throw("e-posta adresi kullanılmaktadır.", HttpStatusCode.BadRequest);
            }
            if (dbUser.gsm != user.gsm && db.users.Any(u => u.gsm == user.gsm))
            {
                ExceptionThrow.Throw("gsm no kullanılmaktadır.", HttpStatusCode.BadRequest);
            }

            if (dbUser.gsm != user.gsm)
            {
                //generate activation code
                Random rnd      = new Random();
                string gsm_code = rnd.Next(9999, 999999).ToString();

                dbUser.state               = false;
                dbUser.gsm_state           = false;
                dbUser.gsm_activation_code = gsm_code;

                //send gsm activation code
                NetGsm.Send(user.gsm, "menkule.com.tr uyeliginiz ile ilgili onay kodunuz: " + gsm_code);
            }
            dbUser.identity_no  = user.identity_no;
            dbUser.gsm          = user.gsm;
            dbUser.email        = user.email;
            dbUser.name         = user.name;
            dbUser.lastname     = user.lastname;
            dbUser.updated_date = DateTime.Now;
            dbUser.identity_no  = user.identity_no;

            db.SaveChanges();

            try
            {
            }
            catch (Exception ex)
            {
                ExceptionThrow.Throw(ex);
            }
            return(Ok(new {
                name = user.name,
                lastname = user.lastname,
                email = user.email,
                gsm = user.gsm,
                gender = user.gender,
                photo = "",
                ownershiping = user.ownershiping,
                state = user.state,
                email_state = user.email_state,
                gsm_state = user.gsm_state,
                created_date = user.created_date
            }));
        }