public void PostShareholderType([FromBody] ShareholderTypeDto shareholderTypeDto) { ShareholderType com = new ShareholderType(); com.Id = shareholderTypeDto.Id; com.Type = shareholderTypeDto.Type; stocky.ShareholderType.Add(com); stocky.SaveChanges(); }
public void PutShareholderType(String id, [FromBody] ShareholderTypeDto shareholderTypeDto) { // stocky.Company.Update(id, com); ShareholderType com = stocky.ShareholderType.Where(e => e.Id == shareholderTypeDto.Id).Single <ShareholderType>(); com.Id = shareholderTypeDto.Id; com.Type = shareholderTypeDto.Type; stocky.Entry(com).State = Microsoft.EntityFrameworkCore.EntityState.Modified; stocky.SaveChanges(); }
public dynamic GetShareholderType() { List <ShareholderType> ShareholderType; List <ShareholderTypeDto> shareholderDtos = new List <ShareholderTypeDto>(); ShareholderType = stocky.ShareholderType.ToList(); foreach (ShareholderType com in ShareholderType) { ShareholderTypeDto dto = new ShareholderTypeDto( com.Id, com.Type); shareholderDtos.Add(dto); } return(shareholderDtos); }