Beispiel #1
0
        public static UserModel ToUserModel(this CompanyDE from, UserModel dest = null)
        {
            var to = dest ?? new UserModel();

            if (to.Id <= 0)
            {
                to.Id       = from.Id;
                to.IsActive = true;
            }
            else
            {
                to.IsActive = from.IsActive;
                //to.ModifiedDate = DateTime.Now;
            }
            // to.LastName = from.bas.LastName;
            ////to.Email = from.Email;
            ////to.Password = from.Password;
            ////to.FirstName = from.Name;

            ///////////////////////////
            ////to.MobilePhone = from.ContactNo;
            //to.Logo = from.Logo;
            //to.CompanyName = from.CompanyName;
            //to.AddressId = from.AddressId;
            //to.UserImagePath = from.UserImagePath;
            //to.Biography = from.Biography;
            //to.CreatedById = from.CreatedById;
            //to.CreatedDate = from.CreatedDate;
            //////////////////////////////

            //to.Salt = from.Salt;                                  //salt
            to.IsActive = from.IsActive;

            return(to);
        }
Beispiel #2
0
        public static CompanyDE Translate(this CompanyMD from, CompanyDE dest = null)
        {
            var to = dest ?? new CompanyDE();

            if (to.Id <= 0)
            {
                to.Id       = from.Id;
                to.IsActive = true;
            }
            else
            {
                to.IsActive = from.IsActive;
                //to.ModifiedDate = DateTime.Now;
            }
            to.Name = from.Name;
            //to.Password = from.Password;

            //to.Email = from.Email;
            //to.ContactNo = from.ContactNo;
            to.Logo = from.Logo;
            //to.Salt = from.Salt;
            //to.PasswordForgetKey = from.PasswordForgetKey;
            to.ImagePath = from.ImagePath;


            return(to);
        }
Beispiel #3
0
        public static CompanyDE Translate(this CompanySignUpModel from, CompanyDE dest = null)
        {
            var to = dest ?? new CompanyDE();

            if (to.Id <= 0)
            {
                to.Id       = from.Id;
                to.IsActive = true;
            }
            else
            {
                to.IsActive = from.IsActive;
                //to.ModifiedDate = DateTime.Now;
            }
            to.Name = from.CompanyName;
            ////to.Email = from.Email;
            ////to.Password = from.Password;
            ////to.ContactNo = from.Phone;
            //to.Logo = from.Logo;
            //to.CompanyName = from.CompanyName;
            //to.AddressId = from.AddressId;
            //to.UserImagePath = from.UserImagePath;
            //to.Biography = from.Biography;
            //to.CreatedById = from.CreatedById;
            //to.CreatedDate = from.CreatedDate;
            //to.IsActive = from.IsActive;

            return(to);
        }
Beispiel #4
0
        public Company Post([FromBody] Company model)
        {
            // POST: api/User
            // this post method insert the new row or update the current row if there is a record with same ID
            CompanyDE de    = new CompanyDE();
            Company   sonuc = de.AddCompany(model, model.User);

            return(sonuc);
        }
Beispiel #5
0
        public IEnumerable <Company> Get(int id)
        {
            // GET: api/Company
            //HttpContext.RiseError(new InvalidOperationException("Test"));
            Company   model = new Company();
            CompanyDE de    = new CompanyDE();

            return(de.GetCompany(id));
        }
Beispiel #6
0
        public IActionResult Delete(int id)
        {
            // DELETE: api/ApiWithActions/5
            CompanyDE de    = new CompanyDE();
            bool      sonuc = de.DeleteCompany(id);

            if (sonuc)
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
Beispiel #7
0
        public IActionResult Put([FromBody] Company model)
        {
            // POST: api/Company
            // this post method insert the new row or update the current row if there is a record with same ID
            CompanyDE de    = new CompanyDE();
            bool      sonuc = de.UpdateCompany(model);

            if (sonuc)
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
Beispiel #8
0
        public static CompanyMD Translate(this CompanyDE from)
        {
            var to = new CompanyMD();

            to.Id   = from.Id;
            to.Name = from.Name;
            //to.Password = from.Password;

            //to.Email = from.Email;
            //to.ContactNo = from.ContactNo;
            to.Logo = from.Logo;
            //to.Salt = from.Salt;
            //to.PasswordForgetKey = from.PasswordForgetKey;
            to.ImagePath = from.ImagePath;

            return(to);
        }