public virtual void Update(CompanyParam companyparam)
 {
     this.Id         = companyparam.Id;
     this.Name       = companyparam.Name;
     this.UpdateDate = DateTimeOffset.Now.LocalDateTime;
     this.UpdatedBy  = companyparam.Id;
 }
Example #2
0
 public Company(CompanyParam companyParam)
 {
     this.Name     = companyParam.Name;
     this.Address  = companyParam.Address;
     this.Username = companyParam.Username;
     this.Password = companyParam.Password;
     this.villages = companyParam.villages;
 }
Example #3
0
 public virtual void Update(CompanyParam companyParam)
 {
     this.Id       = companyParam.Id;
     this.Name     = companyParam.Name;
     this.Address  = companyParam.Address;
     this.Username = companyParam.Username;
     this.Password = companyParam.Password;
     this.villages = companyParam.villages;
 }
Example #4
0
        // POST: api/Companies
        public HttpResponseMessage InsertClass(CompanyParam CompanyParam)
        {
            var message = Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Wrong Parameter");
            var result  = _iCompanyService.Insert(CompanyParam);

            if (result)
            {
                message = Request.CreateResponse(HttpStatusCode.OK, "Successfully Added");
            }
            return(message);
        }
 public bool Insert(CompanyParam companyParam)
 {
     if (companyParam == null)
     {
         throw new NullReferenceException();
     }
     else if (companyParam.Name == " " || companyParam.Address == " " || companyParam.Village_Id.ToString() == " ")
     {
         status = false;
     }
     else
     {
         status = _companyRepository.Insert(companyParam);
     }
     return(status);
 }
Example #6
0
        public bool Insert(CompanyParam companyParam)
        {
            company.Name    = companyParam.Name;
            company.Address = companyParam.Address;
            var getVillage = myContext.Villages.Find(companyParam.Village_Id);

            company.Village    = getVillage;
            company.CreateDate = DateTimeOffset.Now.LocalDateTime;
            myContext.Companies.Add(company);
            var result = myContext.SaveChanges();

            if (result > 0)
            {
                status = true;
            }
            return(status);
        }
Example #7
0
        public bool Update(int?id, CompanyParam companyParam)
        {
            var get = Get(id);

            get.Name    = companyParam.Name;
            get.Address = companyParam.Address;
            var getVillage = myContext.Villages.Find(companyParam.Village_Id);

            get.Village    = getVillage;
            get.UpdateDate = DateTimeOffset.Now.LocalDateTime;
            var result = myContext.SaveChanges();

            if (result > 0)
            {
                status = true;
            }
            return(status);
        }
Example #8
0
        // PUT: api/Companies/5
        public HttpResponseMessage UpdateClass(int id, CompanyParam CompanyParam)
        {
            var message = Request.CreateErrorResponse(HttpStatusCode.NotFound, "Bad Request");

            if (string.IsNullOrWhiteSpace(id.ToString()))
            {
                message = Request.CreateErrorResponse(HttpStatusCode.NotFound, "Invalid Id");
            }
            else
            {
                var get = _iCompanyService.Update(id, CompanyParam);
                if (get)
                {
                    message = Request.CreateResponse(HttpStatusCode.OK, get);
                    return(message);
                }
            }
            return(message);
        }
        public bool Update(int?id, CompanyParam companyParam)
        {
            if (id == null)
            {
                throw new NullReferenceException();
            }
            var get = Get(id);

            if (companyParam == null)
            {
                throw new NullReferenceException();
            }
            else if (companyParam.Name == " " || companyParam.Address == " " || companyParam.Village_Id.ToString() == " ")
            {
                status = false;
            }
            else
            {
                status = _companyRepository.Update(id, companyParam);
            }
            return(status);
        }
 public Company(CompanyParam companyparam)
 {
     this.Name       = companyparam.Name;
     this.CreateDate = DateTimeOffset.Now.LocalDateTime;
     this.CreatedBy  = companyparam.Id;
 }
 // PUT: api/Companies/5
 public void Put(int id, CompanyParam companyParam)
 {
     _companyService.Update(id, companyParam);
 }
 // POST: api/Companies
 public void Post(CompanyParam companyParam)
 {
     _companyService.Insert(companyParam);
 }
 public bool Update(CompanyParam companyParam)
 {
     throw new NotImplementedException();
 }
 public bool Insert(CompanyParam companyParam)
 {
     throw new NotImplementedException();
 }