Ejemplo n.º 1
0
        public async Task <IActionResult> CreateRoaster(Roaster roaster, byte[] picture)
        {
            try
            {
                var roastDate = DateTime.UtcNow;
                var roaster1  = Roaster.New(roaster.ContactPersonName,
                                            roaster.ContactPersonPhone,
                                            roaster.Name,
                                            roaster.ContactNumber,
                                            roaster.ContactEmail,
                                            roaster.WebSiteLink,
                                            roaster.VkProfileLink,
                                            roaster.InstagramProfileLink,
                                            roaster.TelegramProfileLink,
                                            roaster.Description,
                                            roastDate,
                                            roaster.Priority
                                            );
                _roasterRepository.Add(roaster);
                await _roasterRepository.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e.ToString()));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Generates Roaster entity brand new id with
 /// </summary>
 /// <param name="roaster"></param>
 /// <param name="addressId"></param>
 /// <returns>Roaster note</returns>
 public static Roaster GenerateRoaster(OwnedRoaster roasterRequest)
 => Roaster.New(roasterRequest.ContactPersonName,
                roasterRequest.ContactPersonNumber,
                roasterRequest.Name,
                roasterRequest.ContactNumber,
                roasterRequest.ContactEmail,
                roasterRequest.WebSiteLink,
                roasterRequest.VkProfileLink,
                roasterRequest.InstagramProfileLink,
                roasterRequest.TelegramProfileLink,
                roasterRequest.Description,
                DateTime.Now,
                roasterRequest.Priority);